]> bicyclesonthemoon.info Git - ott/bsta/blob - makefile.1.mak
Adapted for new config tool.
[ott/bsta] / makefile.1.mak
1 # "makefile" is automatically generated from "makefile.1.mak"
2
3 # Copyright (C) 2016, 2017, 2023  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_LIB_PATH:  LIB_PATH  = /botm/lib/bsta
39 ###MAKE_LOG_PATH:  LOG_PATH  = /botm/log/bsta
40 ###MAKE_TMP_PATH:  TMP_PATH  = /botm/tmp/bsta
41 ###MAKE_WWW_PATH:  WWW_PATH  = /botm/www/1190/bsta
42
43 ###MAKE_CONF: CONF = /botm/etc/www/conf/1190/bsta.conf
44 ###MAKE_CRON: CRON = /etc/cron.d/bsta
45
46 CONFIGFILE = settings-$(TARGET).txt settings.txt
47 DEFAULT_CONFIGFILE = settings-$(DEFAULT_TARGET).txt settings.txt
48
49 # The configuration tool
50 CONFIGURE_CMD = $(PERL) ./configure.pl $(CONFIGFILE)
51
52 # keep these 2 lists in the same order!:
53 GENERATE_FROM=\
54 2words.1.pl\
55 attach.1.pl\
56 bbcode.1.pl\
57 bsta.1.conf\
58 bsta.1.cron\
59 bsta_lib.1.pm\
60 chat.1.pl\
61 frame.1.pl\
62 goto.1.pl\
63 info.1.pl\
64 oldlogs.1.pl\
65 ong.1.pl\
66 reset.1.pl\
67 updlist.1.pl\
68 viewer.1.pl
69
70 TO_GENERATE=\
71 2words.pl\
72 attach.pl\
73 bbcode.pl\
74 bsta.conf\
75 bsta.cron\
76 bsta_lib.pm\
77 chat.pl\
78 frame.pl\
79 goto.pl\
80 info.pl\
81 oldlogs.pl\
82 ong.pl\
83 reset.pl\
84 updlist.pl\
85 viewer.pl
86
87 DIR=\
88 $(BIN_PATH)\
89 $(DATA_PATH)\
90 $(LIB_PATH)\
91 $(LOG_PATH)\
92 $(TMP_PATH)\
93 $(WWW_PATH)
94
95 HIDDEN_DIR=\
96 $(DATA_PATH)\
97 $(TMP_PATH)
98
99 SETUID=\
100 2words\
101 bbcode\
102 attach\
103 chat\
104 frame\
105 goto\
106 info\
107 viewer
108
109 EXEC=\
110 2words.pl\
111 attach.pl\
112 bbcode.pl\
113 chat.pl\
114 frame.pl\
115 goto.pl\
116 info.pl\
117 oldlogs.pl\
118 ong.pl\
119 reset.pl\
120 updlist.pl\
121 viewer.pl
122
123 PERL_WRAP_EXEC=\
124 2words\
125 attach\
126 bbcode\
127 chat\
128 frame\
129 goto\
130 info\
131 viewer
132
133 BIN=\
134 $(EXEC)\
135 $(PERL_WRAP_EXEC)
136
137 LIB=\
138 bsta_lib.pm
139
140 WWW=\
141 botmlogo.png\
142 bsta.css\
143 timer.js
144
145
146 all: $(BIN) setuid exec
147
148 makefile: makefile.1.mak $(CONFIGFILE) configure.pl
149         $(CONFIGURE_CMD) < makefile.1.mak > makefile
150
151 configure.pl: $(CONFIGFILE) config/configure.1.pl
152         $(PERL) config/configure.1.pl target=direct settings-$(TARGET).txt config/settings.txt --in config/configure.1.pl --out configure.pl
153
154 $(TO_GENERATE): $(GENERATE_FROM) $(CONFIGFILE) configure.pl
155         $(CONFIGURE_CMD) --in $(GENERATE_FROM) --out $(TO_GENERATE)
156
157 $(PERL_WRAP_EXEC): %: exec/exec.c exec/settings.txt configure.pl
158         $(PERL) configure.pl path=$(BIN_PATH) target=$*.pl io_path=$(LOG_PATH) stderr=$*-stderr.log exec/settings.txt --in exec/exec.c --out $*.c
159         $(CC) $(CF) -o $@ $*.c
160
161 exec: $(EXEC)
162         $(CHMOD) +x $(EXEC)
163
164 wrap_exec: 
165         
166 setuid: $(SETUID)
167         $(CHMOD) u+s,g+s $(SETUID)
168
169
170 mktree:
171         $(MKDIR) -p $(DIR)
172         $(CHMOD) g-r,g-w,g-x,o-r,o-w,o-x $(HIDDEN_DIR)
173
174 ifdef BIN_PATH
175 cp_bin: $(BIN) setuid exec | mktree
176         $(RM) -f $(BIN_PATH)/*
177         $(CP) -p $(BIN) $(BIN_PATH)
178 endif
179
180 ifdef LIB_PATH
181 cp_lib: $(LIB) | mktree
182         $(RM) -f $(LIB_PATH)/*
183         $(CP) -p $(LIB) $(LIB_PATH)
184 endif
185
186 cp_www:
187         $(CP) -p $(WWW) $(WWW_PATH)
188
189 cp_conf: bsta.conf
190         $(CP) bsta.conf $(CONF)
191
192 cp_cron: bsta.cron
193         $(SUDO) $(CP) bsta.cron $(CRON)
194
195 install: all cp_bin cp_lib cp_www cp_conf cp_cron
196
197 clean:
198         $(RM) -f configure.pl $(TO_GENERATE) $(PERL_WRAP_EXEC) $(PERL_WRAP_EXEC:=.c)
199         $(PERL) config/configure.1.pl $(DEFAULT_CONFIGFILE) < makefile.1.mak > makefile
200
201 PHONY: all clean install setuid exec mktree cp_bin cp_lib cp_www cp_conf cp_cron