# "makefile" is automatically generated from "makefile.1.mak" # # Copyright (C) 2016, 2017, 2023, 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 . DEFAULT_TARGET = debug ifndef TARGET TARGET = $(DEFAULT_TARGET) ###MAKE_TARGET: # when want to change target run this first: # make -B TARGET=target_name makefile endif PERL = perl ###MAKE_CC: CC=gcc ###MAKE_CF: CF=-g -Wall ###MAKE_CHMOD: CHMOD = chmod ###MAKE_CP: CP = cp ###MAKE_MKDIR: MKDIR = mkdir ###MAKE_PERL: PERL = perl ###MAKE_RM: RM = rm ###MAKE_SUDO: SUDO = sudo ###MAKE_BIN_PATH: BIN_PATH = /botm/bin/bsta ###MAKE_DATA_PATH: DATA_PATH = /botm/data/bsta ###MAKE_DATA_WORDS_PATH: DATA_WORDS_PATH = /botm/data/bsta/words ###MAKE_LIB_PATH: LIB_PATH = /botm/lib/bsta ###MAKE_LOG_PATH: LOG_PATH = /botm/log/bsta ###MAKE_TMP_PATH: TMP_PATH = /botm/tmp/bsta ###MAKE_WWW_PATH: WWW_PATH = /botm/www/1190/bsta ###MAKE_CONF: CONF = /botm/etc/www/conf/1190/bsta.conf ###MAKE_CRON: CRON = /etc/cron.d/bsta CONFIGFILE = settings-$(TARGET).txt settings.txt DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt # The configuration tool CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE) # keep these 2 lists in the same order!: GENERATE_FROM=\ 2words.1.pl\ attach.1.pl\ bbcode.1.pl\ bsta.1.conf\ bsta.1.cron\ bsta_lib.1.pm\ chat.1.pl\ frame.1.pl\ goto.1.pl\ info.1.pl\ opomba.1.pl\ ong.1.pl\ reset.1.pl\ update.1.pl\ viewer.1.pl TO_GENERATE=\ 2words.pl\ attach.pl\ bbcode.pl\ bsta.conf\ bsta.cron\ bsta_lib.pm\ chat.pl\ frame.pl\ goto.pl\ info.pl\ opomba.pl\ ong.pl\ reset.pl\ update.pl\ viewer.pl DIR=\ $(BIN_PATH)\ $(DATA_PATH)\ $(DATA_WORDS_PATH)\ $(LIB_PATH)\ $(LOG_PATH)\ $(TMP_PATH)\ $(WWW_PATH) HIDDEN_DIR=\ $(DATA_PATH)\ $(DATA_WORDS_PATH)\ $(TMP_PATH) SETUID=\ 2words\ bbcode\ attach\ chat\ frame\ goto\ info\ opomba\ viewer EXEC=\ 2words.pl\ attach.pl\ bbcode.pl\ chat.pl\ frame.pl\ goto.pl\ info.pl\ opomba.pl\ ong.pl\ reset.pl\ update.pl\ viewer.pl PERL_WRAP_EXEC=\ 2words\ attach\ bbcode\ chat\ frame\ goto\ info\ opomba\ viewer BIN=\ $(EXEC)\ $(PERL_WRAP_EXEC) LIB=\ botm-common/botm_common.pm\ bsta_lib.pm WWW=\ botmlogo.png\ bsta.css\ timer.js all: $(BIN) setuid exec makefile: makefile.1.mak $(CONFIGFILE) configure.pl $(CONFIGURE_CMD) < makefile.1.mak > makefile configure.pl: $(CONFIGFILE) config/configure.1.pl $(PERL) config/configure.1.pl target=direct settings-$(TARGET).txt config/settings.txt --in config/configure.1.pl --out configure.pl $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) configure.pl $(CONFIGURE_CMD) --in $(GENERATE_FROM) --out $(TO_GENERATE) $(PERL_WRAP_EXEC): %: exec/exec.c exec/settings.txt configure.pl $(PERL) configure.pl path=$(BIN_PATH) target=$*.pl io_path=$(LOG_PATH) stderr=$*-stderr.log exec/settings.txt --in exec/exec.c --out $*.c $(CC) $(CF) -o $@ $*.c exec: $(EXEC) $(CHMOD) +x $(EXEC) wrap_exec: 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 exec | mktree $(RM) -f $(BIN_PATH)/* $(CP) -p $(BIN) $(BIN_PATH) endif ifdef LIB_PATH cp_lib: $(LIB) | mktree $(RM) -f $(LIB_PATH)/* $(CP) -p $(LIB) $(LIB_PATH) endif cp_www: $(CP) -p $(WWW) $(WWW_PATH) cp_conf: bsta.conf $(CP) bsta.conf $(CONF) cp_cron: bsta.cron $(SUDO) $(CP) bsta.cron $(CRON) install: all cp_bin cp_lib cp_www cp_conf cp_cron clean: $(RM) -f configure.pl $(TO_GENERATE) $(PERL_WRAP_EXEC) $(PERL_WRAP_EXEC:=.c) $(PERL) config/configure.1.pl $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile PHONY: all clean install setuid exec mktree cp_bin cp_lib cp_www cp_conf cp_cron