-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
220 lines (157 loc) · 5.94 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# Makefile for Tokyo Promenade
#================================================================
# Setting Variables
#================================================================
# Generic settings
SHELL = @SHELL@
# Package information
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
PACKAGEDIR = $(PACKAGE)-$(VERSION)
PACKAGETGZ = $(PACKAGE)-$(VERSION).tar.gz
# Targets
COMMANDFILES = @MYCOMMANDFILES@
CGIFILES = @MYCGIFILES@
CGISCRFILES = @MYCGISCRFILES@
MAN1FILES = @MYMAN1FILES@
DATAFILES = @MYDATAFILES@
DOCUMENTFILES = @MYDOCUMENTFILES@
# Install destinations
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
BINDIR = @bindir@
LIBEXECDIR = @libexecdir@
DATADIR = @datadir@/$(PACKAGE)
MAN1DIR = @mandir@/man1
DESTDIR =
# Building configuration
CC = @CC@
CPPFLAGS = @MYCPPFLAGS@
CFLAGS = @MYCFLAGS@
LDFLAGS = @MYLDFLAGS@
CMDLDFLAGS = @MYCMDLDFLAGS@
LIBS = @LIBS@
LDENV = LD_RUN_PATH=/lib:/usr/lib:$(LIBDIR):$(HOME)/lib:/usr/local/lib:@MYRUNPATH@:.
RUNENV = @MYLDLIBPATHENV@=.:/lib:/usr/lib:$(LIBDIR):$(HOME)/lib:/usr/local/lib:@MYRUNPATH@
POSTCMD = @MYPOSTCMD@
#================================================================
# Suffix rules
#================================================================
.SUFFIXES :
.SUFFIXES : .c .o
.c.o :
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
#================================================================
# Actions
#================================================================
all : $(COMMANDFILES) $(CGIFILES)
@$(POSTCMD)
@printf '\n'
@printf '#================================================================\n'
@printf '# Ready to install.\n'
@printf '#================================================================\n'
clean :
rm -rf $(LIBRARYFILES) $(LIBOBJFILES) $(COMMANDFILES) $(CGIFILES) \
*.o a.out check.in check.out gmon.out *.vlog casket* *.tct* upload \
*~ hoge moge tako ika tmp diff
version :
sed -e 's/TPVERSION.*/TPVERSION "$(VERSION)"/' common.h > common.h~
[ -f common.h~ ] && mv -f common.h~ common.h
untabify :
ls *.c *.h | while read name ; \
do \
sed -e 's/\t/ /g' -e 's/ *$$//' $$name > $$name~; \
[ -f $$name~ ] && mv -f $$name~ $$name ; \
done
password :
printf '[salt]:tokyopromenade\n' > passwd.txt
printf '[riddle]:tokyo:Where is the capital city of Japan?\n' >> passwd.txt
printf 'admin:41109d0fe0b2c6fcded40bec321c7e0f:Administrator\n' >> passwd.txt
install :
mkdir -p $(DESTDIR)$(BINDIR)
cp -Rf $(COMMANDFILES) $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(LIBEXECDIR)
cp -Rf $(CGIFILES) $(CGISCRFILES) $(DESTDIR)$(LIBEXECDIR)
mkdir -p $(DESTDIR)$(DATADIR)
cp -Rf $(DATAFILES) $(DOCUMENTFILES) $(DESTDIR)$(DATADIR)
mkdir -p $(DESTDIR)$(MAN1DIR)
cd man && cp -Rf $(MAN1FILES) $(DESTDIR)$(MAN1DIR)
@printf '\n'
@printf '#================================================================\n'
@printf '# Thanks for using Tokyo Promenade.\n'
@printf '#================================================================\n'
install-strip :
make DESTDIR=$(DESTDIR) install
cd $(DESTDIR)$(BINDIR) && strip $(MYCOMMANDS)
uninstall :
cd $(DESTDIR)$(BINDIR) && rm -f $(COMMANDFILES)
cd $(DESTDIR)$(LIBEXECDIR) && rm -f $(CGIFILES) $(CGISCRFILES)
cd $(DESTDIR)$(MAN1DIR) && rm -f $(MAN1FILES)
rm -rf $(DESTDIR)$(DATADIR)
dist :
make version
make untabify
make password
make distclean
cd .. && tar cvf - $(PACKAGEDIR) | gzip -c > $(PACKAGETGZ)
sync ; sync
distclean : clean
rm -rf Makefile tokyopromenade.pc config.cache config.log config.status autom4te.cache
check :
rm -rf casket*
$(RUNENV) $(RUNCMD) ./prommgr version
$(RUNENV) $(RUNCMD) ./prommgr convert -page misc/tc.tpw > check.out
$(RUNENV) $(RUNCMD) ./prommgr convert -fw misc/tc.tpw > check.out
$(RUNENV) $(RUNCMD) ./prommgr convert -ft misc/tc.tpw > check.out
$(RUNENV) $(RUNCMD) ./prommgr create -fts casket 100000
$(RUNENV) $(RUNCMD) ./prommgr import casket misc > check.out
$(RUNENV) $(RUNCMD) ./prommgr export casket 1978 > check.out
$(RUNENV) $(RUNCMD) ./prommgr update casket 1978 check.out
$(RUNENV) $(RUNCMD) ./prommgr remove casket 1978
$(RUNENV) $(RUNCMD) ./promenade.cgi > check.out
$(RUNENV) QUERY_STRING="name=Tokyo+Cabinet" $(RUNCMD) ./promenade.cgi > check.out
$(RUNENV) QUERY_STRING="id=1978" $(RUNCMD) ./promenade.cgi > check.out
$(RUNENV) QUERY_STRING="name=dup" $(RUNCMD) ./promenade.cgi > check.out
$(RUNENV) QUERY_STRING="act=edit&id=1978" $(RUNCMD) ./promenade.cgi > check.out
rm -rf casket*
@printf '\n'
@printf '#================================================================\n'
@printf '# Checking completed.\n'
@printf '#================================================================\n'
check-valgrind :
make RUNCMD="valgrind --tool=memcheck --log-file=%p.vlog" check
grep ERROR *.vlog | grep -v ' 0 errors' ; true
grep 'at exit' *.vlog | grep -v ' 0 bytes' ; true
check-forever :
while true ; \
do \
make check || break ; \
done
init :
rm -rf promenade.tct* tmp upload
./prommgr import promenade.tct misc
mkdir tmp
for((i=1;i<=100;i++)); do \
printf '#! test\n#c %d000000\n\nDUP TEST No. %d.\n' "$$i" "$$i" \
> "tmp/dup$$i.tpw" ; \
printf '#! TEST%d\n#c %d0000\n\nTEST No. %d.\n' "$$i" "$$i" "$$i" \
> "tmp/$$i.tpw" ; \
done
./prommgr import promenade.tct tmp
rm -rf tmp
mkdir upload
.PHONY : all clean install check
#================================================================
# Building binaries
#================================================================
prommgr : prommgr.o common.o scrext.o
$(LDENV) $(CC) $(CFLAGS) -o $@ $< common.o scrext.o $(LDFLAGS) $(CMDLDFLAGS) $(LIBS)
promenade.cgi : promenade.o common.o scrext.o
$(LDENV) $(CC) $(CFLAGS) -o $@ $< common.o scrext.o $(LDFLAGS) $(CMDLDFLAGS) $(LIBS)
promenade.fcgi : promenade.c common.o scrext.o
$(LDENV) $(CC) $(CFLAGS) $(CPPFLAGS) -DMYFCGI -o $@ $< common.o scrext.o \
$(LDFLAGS) $(CMDLDFLAGS) -lfcgi $(LIBS)
common.o prommgr.o promenade.o : common.h
scrext.o prommgr.o promenade.o : scrext.h
# END OF FILE