]> bicyclesonthemoon.info Git - ott/bsta/blob - makefile.1.mak
change makefile regeneration command
[ott/bsta] / makefile.1.mak
1 # "makefile" is automatically generated from "makefile.1.mak"
2
3 # Copyright (C) 2016, 2017, 2023, 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 DEFAULT_TARGET = debug
19 ifndef TARGET
20 TARGET = $(DEFAULT_TARGET) ###MAKE_TARGET:
21 # when want to change target run this first:
22 # make -B TARGET=target_name makefile
23 endif
24 PERL = perl
25
26 ###MAKE_CC:    CC=gcc
27 ###MAKE_CF:    CF=-g -Wall
28
29 ###MAKE_CHMOD: CHMOD = chmod
30 ###MAKE_CP:    CP    = cp
31 ###MAKE_MKDIR: MKDIR = mkdir
32 ###MAKE_PERL:  PERL  = perl
33 ###MAKE_RM:    RM    = rm
34 ###MAKE_SUDO:  SUDO  = sudo
35
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
43
44 ###MAKE_CONF: CONF = /botm/etc/www/conf/1190/bsta.conf
45 ###MAKE_CRON: CRON = /etc/cron.d/bsta
46
47 CONFIGFILE = settings-$(TARGET).txt settings.txt
48 DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt
49
50 # The configuration tool
51 CONFIGURE_CMD = $(PERL) ./configure.pl --do $(CONFIGFILE)
52
53 # keep these 2 lists in the same order!:
54 GENERATE_FROM=\
55 2words.1.pl\
56 attach.1.pl\
57 bbcode.1.pl\
58 bsta.1.conf\
59 bsta.1.cron\
60 bsta_lib.1.pm\
61 chat.1.pl\
62 frame.1.pl\
63 goto.1.pl\
64 info.1.pl\
65 opomba.1.pl\
66 ong.1.pl\
67 reset.1.pl\
68 update.1.pl\
69 viewer.1.pl
70
71 TO_GENERATE=\
72 2words.pl\
73 attach.pl\
74 bbcode.pl\
75 bsta.conf\
76 bsta.cron\
77 bsta_lib.pm\
78 chat.pl\
79 frame.pl\
80 goto.pl\
81 info.pl\
82 opomba.pl\
83 ong.pl\
84 reset.pl\
85 update.pl\
86 viewer.pl
87
88 DIR=\
89 $(BIN_PATH)\
90 $(DATA_PATH)\
91 $(DATA_WORDS_PATH)\
92 $(LIB_PATH)\
93 $(LOG_PATH)\
94 $(TMP_PATH)\
95 $(WWW_PATH)
96
97 HIDDEN_DIR=\
98 $(DATA_PATH)\
99 $(DATA_WORDS_PATH)\
100 $(TMP_PATH)
101
102 SETUID=\
103 2words\
104 bbcode\
105 attach\
106 chat\
107 frame\
108 goto\
109 info\
110 opomba\
111 viewer
112
113 EXEC=\
114 2words.pl\
115 attach.pl\
116 bbcode.pl\
117 chat.pl\
118 frame.pl\
119 goto.pl\
120 info.pl\
121 opomba.pl\
122 ong.pl\
123 reset.pl\
124 update.pl\
125 viewer.pl
126
127 PERL_WRAP_EXEC=\
128 2words\
129 attach\
130 bbcode\
131 chat\
132 frame\
133 goto\
134 info\
135 opomba\
136 viewer
137
138 BIN=\
139 $(EXEC)\
140 $(PERL_WRAP_EXEC)
141
142 LIB=\
143 botm-common/botm_common.pm\
144 bsta_lib.pm
145
146 WWW=\
147 botmlogo.png\
148 bsta.css\
149 timer.js
150
151
152 all: $(BIN) setuid exec
153         
154
155 makefile: makefile.1.mak $(CONFIGFILE) configure.pl
156         $(CONFIGURE_CMD) --in makefile.1.mak --out makefile
157
158 configure.pl: $(CONFIGFILE) config/configure.1.pl
159         $(PERL) config/configure.1.pl --do target=direct settings-$(TARGET).txt config/settings.txt --in config/configure.1.pl --out configure.pl
160
161 $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) configure.pl
162         $(CONFIGURE_CMD) --v --in $(GENERATE_FROM) --out $(TO_GENERATE)
163
164 $(PERL_WRAP_EXEC): %: exec/exec.c exec/settings.txt configure.pl
165         $(PERL) configure.pl --do 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
167
168 exec: $(EXEC)
169         $(CHMOD) +x $(EXEC)
170
171 wrap_exec: 
172         
173 setuid: $(SETUID)
174         $(CHMOD) u+s,g+s $(SETUID)
175
176
177 mktree:
178         $(MKDIR) -p $(DIR)
179         $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
180
181 ifdef BIN_PATH
182 cp_bin: $(BIN) setuid exec | mktree
183         $(RM) -f $(BIN_PATH)/*
184         $(CP) -p $(BIN) $(BIN_PATH)
185 endif
186
187 ifdef LIB_PATH
188 cp_lib: $(LIB) | mktree
189         $(RM) -f $(LIB_PATH)/*
190         $(CP) -p $(LIB) $(LIB_PATH)
191 endif
192
193 cp_www:
194         $(CP) -p $(WWW) $(WWW_PATH)
195
196 cp_conf: bsta.conf
197         $(CP) bsta.conf $(CONF)
198
199 cp_cron: bsta.cron
200         $(SUDO) $(CP) bsta.cron $(CRON)
201
202 install: all cp_bin cp_lib cp_www cp_conf cp_cron
203         
204
205 clean:
206         $(RM) -f configure.pl $(TO_GENERATE) $(PERL_WRAP_EXEC) $(PERL_WRAP_EXEC:=.c)
207         $(PERL) config/configure.1.pl --do $(DEFAULT_CONFIGFILE) --in makefile.1.mak --out makefile
208
209 PHONY: all clean install setuid exec mktree cp_bin cp_lib cp_www cp_conf cp_cron
210