From: b Date: Sun, 13 Nov 2022 00:33:25 +0000 (+0000) Subject: generate standalone subtools X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=162788c4faa0ae4e69ef84cb2718bf086d906624;p=ott%2Fenhance generate standalone subtools --- diff --git a/makefile b/makefile index b3d7803..ebbf22f 100644 --- a/makefile +++ b/makefile @@ -35,8 +35,18 @@ CC =gcc L_IL =-lIL L_CGI=-lcgi +RM =/usr/bin/rm + +STANDALONE=\ +nofading\ +info + +C_STANDALONE=\ +standalone-nofading.c\ +standalone-info.c + #all: 403 npb npbd npb-ong1 npbd-ong1 bluenh bluenhd insert extract seediff insertframe mremapt-1 compare nofading nofadingd -all: enhance +all: enhance $(STANDALONE) makefile: makefile.1.mak $(CONFIGFILE) @@ -46,11 +56,18 @@ makefile: makefile.1.mak $(CONFIGFILE) enhance: enhance.c core.h core.c nofading.h nofading.c info.h info.c $(CC) $(CF) -o enhance enhance.c core.c nofading.c info.c $(L_IL) +$(STANDALONE): %: standalone-%.c %.c %.h core.c core.h + $(CC) $(CF) -o $@ standalone-$*.c $*.c core.c $(L_IL) + +$(C_STANDALONE): standalone-%.c: settings-standalone.txt standalone.c + $(CONFIGURE) subtool=$* settings-standalone.txt --in standalone.c --out $@ + + #test: test.c core.h core.c # $(CC) $(CF) -o test test.c core.c $(LF) clean: - rm enhance + $(RM) -f enhance $(C_STANDALONE) $(STANDALONE) PHONY: all clean diff --git a/makefile.1.mak b/makefile.1.mak index 7ec7196..5e34c8e 100644 --- a/makefile.1.mak +++ b/makefile.1.mak @@ -35,8 +35,18 @@ CONFIGURE_CMD = $(PERL) $(CONFIGURE) $(CONFIGFILE) ###MAKE_L_IL: L_IL=-lIL ###MAKE_L_CGI: L_CGI=-lcgi +###MAKE_RM: RM = rm + +STANDALONE=\ +nofading\ +info + +C_STANDALONE=\ +standalone-nofading.c\ +standalone-info.c + #all: 403 npb npbd npb-ong1 npbd-ong1 bluenh bluenhd insert extract seediff insertframe mremapt-1 compare nofading nofadingd -all: enhance +all: enhance $(STANDALONE) makefile: makefile.1.mak $(CONFIGFILE) @@ -46,11 +56,18 @@ makefile: makefile.1.mak $(CONFIGFILE) enhance: enhance.c core.h core.c nofading.h nofading.c info.h info.c $(CC) $(CF) -o enhance enhance.c core.c nofading.c info.c $(L_IL) +$(STANDALONE): %: standalone-%.c %.c %.h core.c core.h + $(CC) $(CF) -o $@ standalone-$*.c $*.c core.c $(L_IL) + +$(C_STANDALONE): standalone-%.c: settings-standalone.txt standalone.c + $(CONFIGURE) subtool=$* settings-standalone.txt --in standalone.c --out $@ + + #test: test.c core.h core.c # $(CC) $(CF) -o test test.c core.c $(LF) clean: - rm enhance + $(RM) -f enhance $(C_STANDALONE) $(STANDALONE) PHONY: all clean diff --git a/nofading.c b/nofading.c index f5b990c..d37f16d 100644 --- a/nofading.c +++ b/nofading.c @@ -65,23 +65,6 @@ ILuint enhance_fading_1ch (ILuint val, ILuint low, ILuint high, ILuint max); int find_fading_range (ILuint n, struct PixelInfo *p, void *data); int enhance_fading (ILuint n, struct PixelInfo *p, void *data); -int main_nofading (int argc, char **argv) -{ - int r; - char *error_text = NO_STR; - - r = init(); - if (r!=0) - finish(r, INIT_FAILED); - - r = subtool_nofading(argc, argv, 1, &error_text); - - if (r!=0) - finish(r, error_text); - - finish(0, ""); -} - int subtool_nofading (int argc, char **argv, int argi, char **err) { uint_fast16_t frame_t = 0; diff --git a/settings-release.txt b/settings-release.txt index 128f446..04e70c2 100644 --- a/settings-release.txt +++ b/settings-release.txt @@ -12,6 +12,8 @@ target: release configure: /botm/bin/config/configure.pl +rm: /usr/bin/rm + CC: gcc CF: -g -Wall L_IL: -lIL diff --git a/settings-standalone.txt b/settings-standalone.txt new file mode 100644 index 0000000..c59f11d --- /dev/null +++ b/settings-standalone.txt @@ -0,0 +1,24 @@ +# settings-standalone.txt +# 12.11.2022 +# +# Copyright (C) 2022 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 . + +_C_DEFINE: #define $0 $1 +_C_DEFINE_STR: #define $0 "@_ESCAPE($1)" +_C_INCLUDE_STR: #include "@_ESCAPE($0)" + +C_STANDALONE_INCLUDE = @_C_INCLUDE_STR($subtool\.h) +C_STANDALONE_SUBTOOL = @_C_DEFINE(SUBTOOL, subtool_$subtool) diff --git a/settings.txt b/settings.txt index 673e960..3f5212b 100644 --- a/settings.txt +++ b/settings.txt @@ -1,4 +1,4 @@ -# setting.txt +# settings.txt # 12.11.2022 # # Copyright (C) 2022 Balthasar Szczepański @@ -16,10 +16,16 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +_C_DEFINE_STR: #define $0 "@_ESCAPE($1)" +# _C_INCLUDE_STR: #include "@_ESCAPE($0)" + MAKE_CONFIGURE = CONFIGURE = $configure MAKE_TARGET = TARGET = $target +MAKE_RM = RM =$rm + + MAKE_CC = CC =$CC MAKE_CF = CF =$CF MAKE_L_IL = L_IL =$L_IL diff --git a/standalone.c b/standalone.c new file mode 100644 index 0000000..f5cc8e3 --- /dev/null +++ b/standalone.c @@ -0,0 +1,43 @@ +/* +standalone.c +general main wrapper for the subtools +12.11.2022 + +Copyright (C) 2022 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 . + +*/ + +#include "core.h" +// ###C_STANDALONE_INCLUDE: #include "TOOL_NAME.h" + +// ###C_STANDALONE_SUBTOOL: #define SUBTOOL "subtool_TOOL_NAME" + +int main (int argc, char **argv) +{ + int r; + char *error_text = NO_STR; + + r = init(); + if (r!=0) + finish(r, INIT_FAILED); + + r = SUBTOOL(argc, argv, 1, &error_text); + + if (r!=0) + finish(r, error_text); + + finish(0, ""); +}