]> bicyclesonthemoon.info Git - ott/enhance/blob - makefile.1.mak
use config tool as submodule
[ott/enhance] / makefile.1.mak
1 # "makefile" is automatically generated from "makefile.1.mak"
2 # 07.12.2022
3
4 # Copyright (C) 2022  Balthasar SzczepaƄski
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU Affero General Public License for more details.
15
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19
20 ifndef TARGET
21 TARGET = debug ###MAKE_TARGET:
22 # when want to change target run this first:
23 # make -B TARGET=target_name makefile
24 endif
25 PERL = perl
26
27
28 ###MAKE_CC:    CC=gcc
29 ###MAKE_CF:    CF=-g -Wall
30 ###MAKE_L_IL:  L_IL=-lIL
31 ###MAKE_L_CGI: L_CGI=-lcgi
32
33 ###MAKE_CAT:   CAT   = cat
34 ###MAKE_CHMOD: CHMOD = chmod
35 ###MAKE_CP:    CP    = cp
36 ###MAKE_MKDIR: MKDIR = mkdir
37 ###MAKE_PERL:  PERL  = perl
38 ###MAKE_RM:    RM    = rm
39
40 ###MAKE_BIN_PATH: BIN_PATH = /botm/bin/enhance
41 ###MAKE_TMP_PATH: TMP_PATH = /botm/tmp/enhance
42 ###MAKE_WWW_PATH: WWW_PATH = /botm/www/1190/enhance
43
44 ###MAKE_CONF: CONF = /botm/etc/www/conf/1190/enhance.conf
45
46
47 CONFIGFILE = settings-$(TARGET).txt settings.txt
48
49 # The configuration tool
50 # http://bicyclesonthemoon.info/git/botm-config 
51 CONFIGURE = $(PERL) ./configure.pl
52 CONFIGURE_CMD = $(CONFIGURE) $(CONFIGFILE)
53
54
55 STANDALONE=\
56 nofading\
57 info\
58 bluenh\
59 reveal\
60 diff\
61 npb\
62 pal_mix\
63 pal_unmix\
64 pal_mixdiff\
65 remap_t_1
66
67 C_STANDALONE=\
68 standalone-nofading.c\
69 standalone-info.c\
70 standalone-bluenh.c\
71 standalone-reveal.c\
72 standalone-diff.c\
73 standalone-npb.c\
74 standalone-pal_mix.c\
75 standalone-pal_unmix.c\
76 standalone-pal_mixdiff.c\
77 standalone-remap_t_1.c
78
79 C_SUBTOOL=\
80 nofading.c\
81 info.c\
82 bluenh.c\
83 reveal.c\
84 diff.c\
85 npb.c\
86 pal_mix.c\
87 pal_unmix.c\
88 pal_mixdiff.c\
89 remap_t_1.c
90
91 H_SUBTOOL=\
92 nofading.h\
93 info.h\
94 bluenh.h\
95 reveal.h\
96 diff.h\
97 npb.h\
98 pal_mix.h\
99 pal_unmix.h\
100 pal_mixdiff.h\
101 remap_t_1.h
102
103 H_PNG=\
104 npb0.h\
105 npb1.h\
106 npb2.h\
107 npb_ong1.h\
108 npb_403.h\
109 nh.h\
110 nf.h\
111 rvl.h\
112 df.h\
113 mpb.h\
114 mpb_503.h\
115 nclr.h\
116 t1.h
117
118 CGI=\
119 bluenh-cgi\
120 nofading-cgi\
121 reveal-cgi\
122 diff-cgi\
123 npb-cgi\
124 pal-cgi\
125 t-1-cgi
126
127 HTM_CGI=\
128 bluenh.htm\
129 nofading.htm\
130 reveal.htm\
131 diff.htm\
132 npb.htm\
133 pal.htm\
134 t-1.htm
135
136 HTM_CGI_1=\
137 bluenh.1.htm\
138 nofading.1.htm\
139 reveal.1.htm\
140 diff.1.htm\
141 npb.1.htm\
142 pal.1.htm\
143 t-1.1.htm
144
145 # keep these 2 lists in the same order!:
146 GENERATE_FROM=\
147 online-core.1.h\
148 enhance.1.conf
149
150 TO_GENERATE=\
151 online-core.h\
152 enhance.conf
153
154 DIR=\
155 $(BIN_PATH)\
156 $(TMP_PATH)\
157 $(WWW_PATH)
158
159 SETUID=\
160 $(CGI)
161
162 BIN=\
163 enhance\
164 $(STANDALONE)\
165 $(CGI)
166
167 WWW=\
168 index.htm\
169 $(HTM_CGI)\
170 param.png
171
172 all: $(BIN) $(WWW) enhance.conf
173         
174
175 makefile: makefile.1.mak $(CONFIGFILE) configure.pl
176         $(CONFIGURE_CMD) < makefile.1.mak > makefile 
177
178 configure.pl: $(CONFIGFILE) config/configure.1.pl
179         $(PERL) config/configure.1.pl target=direct settings-$(TARGET).txt config/settings.txt --in config/configure.1.pl --out configure.pl
180
181
182 enhance: enhance.c core.h core.c $(H_SUBTOOL) $(C_SUBTOOL) $(H_PNG)
183         $(CC) $(CF) -o enhance enhance.c core.c $(C_SUBTOOL) $(L_IL)
184
185 $(STANDALONE): %: standalone-%.c %.c %.h core.c core.h $(H_PNG)
186         $(CC) $(CF) -o $@ standalone-$*.c $*.c core.c $(L_IL)
187
188 $(C_STANDALONE): standalone-%.c: settings-subtool.txt standalone.c configure.pl
189         $(CONFIGURE) subtool=$* settings-subtool.txt --in standalone.c --out $@
190
191 $(H_SUBTOOL): %.h: settings-subtool.txt subtool.h configure.pl
192         $(CONFIGURE) subtool=$* settings-subtool.txt --in subtool.h --out $@
193
194 $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE)  configure.pl
195         $(CONFIGURE_CMD) --in $(GENERATE_FROM) --out $(TO_GENERATE)
196         
197 $(CGI): %: %.c online-core.c online-core.h $(H_PNG)
198         $(CC) $(CF) -o $@ $*.c online-core.c $(L_CGI)
199
200 $(H_PNG): %.h: %.png f2h
201         ./f2h $* $*.png $@
202
203 f2h: f2h.c
204         $(CC) $(CF) -o f2h f2h.c
205
206 $(HTM_CGI): %.htm: enhance-top.htm enhance-bottom.htm %.1.htm $(CONFIGFILE) configure.pl
207         $(CAT) enhance-top.htm $*.1.htm enhance-bottom.htm | $(CONFIGURE) _HTML_TITLE=\$$title_$* $(CONFIGFILE) > $*.htm
208
209 index.htm: enhance-top.htm enhance-bottom.htm $(HTM_CGI_1) $(CONFIGFILE) configure.pl
210         $(CAT) enhance-top.htm $(HTM_CGI_1) enhance-bottom.htm | $(CONFIGURE) _HTML_TITLE=\$$title_enhance $(CONFIGFILE) > index.htm
211
212
213 setuid: $(SETUID)
214         $(CHMOD) u+s,g+s $(SETUID)
215
216 mktree:
217         $(MKDIR) -p $(DIR)
218 #       $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
219
220 ifdef BIN_PATH
221 cp_bin: $(BIN) setuid | mktree
222         $(RM) -f $(BIN_PATH)/*
223         $(CP) -p $(BIN) $(BIN_PATH)
224 endif
225
226 cp_conf: enhance.conf
227         $(CP) enhance.conf $(CONF)
228
229 cp_www: $(WWW) | mktree
230         $(CP) -r $(WWW) $(WWW_PATH)
231
232 install: all cp_bin cp_www cp_conf
233
234 clean:
235         $(RM) -f enhance configure.pl $(C_STANDALONE) $(STANDALONE) $(TO_GENERATE) f2h $(H_PNG) $(H_SUBTOOL) $(CGI) index.htm $(HTM_CGI)
236
237 PHONY: all clean install setuid mktree cp_bin cp_www
238
239 #compare: compare.c makefile
240 #       $(CC) $(CF) $(LF) -o compare compare.c