1 # "makefile" is automatically generated from "makefile.1.mak"
3 # Copyright (C) 2016, 2017, 2023, 2024 Balthasar SzczepaĆski
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.
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.
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/>.
18 DEFAULT_TARGET = debug
20 TARGET = $(DEFAULT_TARGET) ###MAKE_TARGET:
21 # when want to change target run this first:
22 # make -B TARGET=target_name makefile
27 ###MAKE_CF: CF=-g -Wall
29 ###MAKE_CHMOD: CHMOD = chmod
31 ###MAKE_MKDIR: MKDIR = mkdir
32 ###MAKE_PERL: PERL = perl
34 ###MAKE_SUDO: SUDO = sudo
36 ###MAKE_BIN_PATH: BIN_PATH = /botm/bin/bsta
37 ###MAKE_DATA_PATH: DATA_PATH = /botm/data/bsta
38 ###MAKE_DATA_WORDS_PATH: DATA_WORDS_PATH = /botm/data/bsta/words
39 ###MAKE_LIB_PATH: LIB_PATH = /botm/lib/bsta
40 ###MAKE_LOG_PATH: LOG_PATH = /botm/log/bsta
41 ###MAKE_TMP_PATH: TMP_PATH = /botm/tmp/bsta
42 ###MAKE_WWW_PATH: WWW_PATH = /botm/www/1190/bsta
44 ###MAKE_CONF: CONF = /botm/etc/www/conf/1190/bsta.conf
45 ###MAKE_CRON: CRON = /etc/cron.d/bsta
47 CONFIGFILE = settings-$(TARGET).txt settings.txt
48 DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt
50 # The configuration tool
51 CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE)
53 # keep these 2 lists in the same order!:
143 botm-common/botm_common.pm\
152 all: $(BIN) setuid exec
155 makefile: makefile.1.mak $(CONFIGFILE) configure.pl
156 $(CONFIGURE_CMD) < makefile.1.mak > makefile
158 configure.pl: $(CONFIGFILE) config/configure.1.pl
159 $(PERL) config/configure.1.pl target=direct settings-$(TARGET).txt config/settings.txt --in config/configure.1.pl --out configure.pl
161 $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) configure.pl
162 $(CONFIGURE_CMD) --in $(GENERATE_FROM) --out $(TO_GENERATE)
164 $(PERL_WRAP_EXEC): %: exec/exec.c exec/settings.txt configure.pl
165 $(PERL) configure.pl path=$(BIN_PATH) target=$*.pl io_path=$(LOG_PATH) stderr=$*-stderr.log exec/settings.txt --in exec/exec.c --out $*.c
166 $(CC) $(CF) -o $@ $*.c
174 $(CHMOD) u+s,g+s $(SETUID)
179 $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
182 cp_bin: $(BIN) setuid exec | mktree
183 $(RM) -f $(BIN_PATH)/*
184 $(CP) -p $(BIN) $(BIN_PATH)
188 cp_lib: $(LIB) | mktree
189 $(RM) -f $(LIB_PATH)/*
190 $(CP) -p $(LIB) $(LIB_PATH)
194 $(CP) -p $(WWW) $(WWW_PATH)
197 $(CP) bsta.conf $(CONF)
200 $(SUDO) $(CP) bsta.cron $(CRON)
202 install: all cp_bin cp_lib cp_www cp_conf cp_cron
206 $(RM) -f configure.pl $(TO_GENERATE) $(PERL_WRAP_EXEC) $(PERL_WRAP_EXEC:=.c)
207 $(PERL) config/configure.1.pl $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile
209 PHONY: all clean install setuid exec mktree cp_bin cp_lib cp_www cp_conf cp_cron