]> bicyclesonthemoon.info Git - ott/enhance/blobdiff - makefile
debug build target; updated config tool; install script
[ott/enhance] / makefile
index 255abbaafadf343f75ee3685bb10bfd55d7b7a2d..93446e1f2f3fc64ff9d21250990ec881578abbbb 100644 (file)
--- a/makefile
+++ b/makefile
-CC=g++
-CF=-g -Wall
-LF=-lIL
-LF2=-lcgi
+# "makefile" is automatically generated from "makefile.1.mak"
+# 
+# Copyright (C) 2022, 2024  Balthasar SzczepaƄski
+# 
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-all: npb npbd
 
-npb: npb.cpp makefile
-       $(CC) $(CF) $(LF) -o npb npb.cpp
 
-npbd: npb npbd.cpp makefile
-       $(CC) $(CF) -o npbd npbd.cpp
+DEFAULT_TARGET = debug
+ifndef TARGET
+TARGET    = debug
+# when want to change target run this first:
+# make -B TARGET=target_name makefile
+endif
+PERL = perl
+
+
+CC   =gcc
+CF   =-g -Wall
+L_IL =-lIL
+L_CGI=-lcgi
+
+CAT  =/usr/bin/cat
+CHMOD=/usr/bin/chmod
+CP   =/usr/bin/cp
+MKDIR=/usr/bin/mkdir
+PERL =/usr/bin/perl
+RM   =/usr/bin/rm
+
+BIN_PATH = /botm/bin/test-enhance
+TMP_PATH = /botm/tmp/test-enhance
+WWW_PATH = /botm/www/1190/enhancetest
+
+CONF = /botm/etc/www/conf/1190/test-enhance.conf
+
+
+CONFIGFILE = settings-$(TARGET).txt settings.txt
+DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt
+
+# The configuration tool
+# http://bicyclesonthemoon.info/git/botm-config 
+CONFIGURE = $(PERL) ./configure.pl --do
+CONFIGURE_CMD = $(CONFIGURE) $(CONFIGFILE)
+
+
+STANDALONE=\
+nofading\
+info\
+bluenh\
+reveal\
+diff\
+npb\
+pal_mix\
+pal_unmix\
+pal_mixdiff\
+remap_t_1
+
+C_STANDALONE=\
+standalone-nofading.c\
+standalone-info.c\
+standalone-bluenh.c\
+standalone-reveal.c\
+standalone-diff.c\
+standalone-npb.c\
+standalone-pal_mix.c\
+standalone-pal_unmix.c\
+standalone-pal_mixdiff.c\
+standalone-remap_t_1.c
+
+C_SUBTOOL=\
+nofading.c\
+info.c\
+bluenh.c\
+reveal.c\
+diff.c\
+npb.c\
+pal_mix.c\
+pal_unmix.c\
+pal_mixdiff.c\
+remap_t_1.c
+
+H_SUBTOOL=\
+nofading.h\
+info.h\
+bluenh.h\
+reveal.h\
+diff.h\
+npb.h\
+pal_mix.h\
+pal_unmix.h\
+pal_mixdiff.h\
+remap_t_1.h
+
+H_PNG=\
+npb0.h\
+npb1.h\
+npb2.h\
+npb_ong1.h\
+npb_403.h\
+nh.h\
+nf.h\
+rvl.h\
+df.h\
+mpb.h\
+mpb_503.h\
+nclr.h\
+t1.h
+
+CGI=\
+bluenh-cgi\
+nofading-cgi\
+reveal-cgi\
+diff-cgi\
+npb-cgi\
+pal-cgi\
+t-1-cgi
+
+HTM_CGI=\
+bluenh.htm\
+nofading.htm\
+reveal.htm\
+diff.htm\
+npb.htm\
+pal.htm\
+t-1.htm
+
+HTM_CGI_1=\
+bluenh.1.htm\
+nofading.1.htm\
+reveal.1.htm\
+diff.1.htm\
+npb.1.htm\
+pal.1.htm\
+t-1.1.htm
+
+# keep these 2 lists in the same order!:
+GENERATE_FROM=\
+online-core.1.h\
+enhance.1.conf
+
+TO_GENERATE=\
+online-core.h\
+enhance.conf
+
+DIR=\
+$(BIN_PATH)\
+$(TMP_PATH)\
+$(WWW_PATH)
+
+SETUID=\
+$(CGI)
+
+BIN=\
+enhance\
+$(STANDALONE)\
+$(CGI)
+
+WWW=\
+index.htm\
+$(HTM_CGI)\
+param.png
+
+all: $(BIN) $(WWW) enhance.conf
+       
+
+makefile: makefile.1.mak $(CONFIGFILE) configure.pl
+       $(CONFIGURE_CMD) --in makefile.1.mak --out makefile 
+
+configure.pl: $(CONFIGFILE) config/configure.1.pl
+       $(PERL) config/configure.1.pl --do target=direct settings-$(TARGET).txt config/settings.txt --in config/configure.1.pl --out configure.pl
+
+
+enhance: enhance.c core.h core.c $(H_SUBTOOL) $(C_SUBTOOL) $(H_PNG)
+       $(CC) $(CF) -o enhance enhance.c core.c $(C_SUBTOOL) $(L_IL)
+
+$(STANDALONE): %: standalone-%.c %.c %.h core.c core.h $(H_PNG)
+       $(CC) $(CF) -o $@ standalone-$*.c $*.c core.c $(L_IL)
+
+$(C_STANDALONE): standalone-%.c: settings-subtool.txt standalone.c configure.pl
+       $(CONFIGURE) subtool=$* settings-subtool.txt --in standalone.c --out $@
+
+$(H_SUBTOOL): %.h: settings-subtool.txt subtool.h configure.pl
+       $(CONFIGURE) subtool=$* settings-subtool.txt --in subtool.h --out $@
+
+$(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE)  configure.pl
+       $(CONFIGURE_CMD) --v --in $(GENERATE_FROM) --out $(TO_GENERATE)
+       
+$(CGI): %: %.c online-core.c online-core.h $(H_PNG)
+       $(CC) $(CF) -o $@ $*.c online-core.c $(L_CGI)
+
+$(H_PNG): %.h: %.png f2h
+       ./f2h $* $*.png $@
+
+f2h: f2h.c
+       $(CC) $(CF) -o f2h f2h.c
+
+$(HTM_CGI): %.htm: enhance-top.htm enhance-bottom.htm %.1.htm $(CONFIGFILE) configure.pl
+       $(CAT) enhance-top.htm $*.1.htm enhance-bottom.htm | $(CONFIGURE) _HTML_TITLE=\$$title_$* $(CONFIGFILE) --out $*.htm
+
+index.htm: enhance-top.htm enhance-bottom.htm $(HTM_CGI_1) $(CONFIGFILE) configure.pl
+       $(CAT) enhance-top.htm $(HTM_CGI_1) enhance-bottom.htm | $(CONFIGURE) _HTML_TITLE=\$$title_enhance $(CONFIGFILE) --out index.htm
+
+
+setuid: $(SETUID)
+       $(CHMOD) u+s,g+s $(SETUID)
+
+mktree:
+       $(MKDIR) -p $(DIR)
+#      $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
+
+ifdef BIN_PATH
+cp_bin: $(BIN) setuid | mktree
+       $(RM) -f $(BIN_PATH)/*
+       $(CP) -p $(BIN) $(BIN_PATH)
+endif
+
+cp_conf: enhance.conf
+       $(CP) enhance.conf $(CONF)
+
+cp_www: $(WWW) | mktree
+       $(CP) -r $(WWW) $(WWW_PATH)
+
+install: all cp_bin cp_www cp_conf
+       
+
+clean:
+       $(RM) -f enhance configure.pl $(C_STANDALONE) $(STANDALONE) $(TO_GENERATE) f2h $(H_PNG) $(H_SUBTOOL) $(CGI) index.htm $(HTM_CGI)
+       $(PERL) config/configure.1.pl --do $(DEFAULT_CONFIGFILE) --in makefile.1.mak --out makefile
+
+PHONY: all clean install setuid mktree cp_bin cp_www
+
+#compare: compare.c makefile
+#      $(CC) $(CF) $(LF) -o compare compare.c