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