-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (49 loc) · 1.49 KB
/
Makefile
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
apacheinc = `apxs -q INCLUDEDIR`
CC = gcc
DEFS = -DHAVE_READ2CH_H
# DEFS = -DCUTRESLINK -DRELOADLINK -DLASTMOD -DNEWBA -DGSTR2 \
# -DTYPE_TERI -DCOOKIE -DPREVENTRELOAD
CFLAGS = -I$(apacheinc) -g -O2 -Wall -funsigned-char -fPIC
LIBS =
OBJS = datindex.o read.o
SRCS = datindex.c digest.c read.c
HDRS = r2chhtml.h r2chhtml_en.h read2ch.h datindex.h digest.h \
read.h
DOCS = Makefile config.txt ChangeLog
.SUFFIXES: .c .o .so
# phony targets
.PHONY:all clean test dat strip tags dist
# targets
read.so: $(OBJS)
all: read.so TAGS
clean:
$(RM) -f read.so *.o
# バイナリのあるファイルの下にtech/dat/998845501.datを置いてから実行
test:
( export HTTP_COOKIE='NAME=abcde%21;MAIL=hoge@huga.net' \
export QUERY_STRING='bbs=tech&key=998845501'; \
export HTTP_USER_AGENT='console'; \
cd tech; \
../read.so )
dat:
( mkdir tech; mkdir tech/dat; \
wget -O tech/dat/998845501.dat \
http://piza2.2ch.net/tech/dat/998845501.dat )
strip: read.so
strip -v $^ $>
dist: read.tgz
read.tgz: $(SRCS) $(HDRS) $(DOCS)
tar cf - $(SRCS) $(HDRS) $(DOCS) \
| gzip -9 > read.tgz
tags: TAGS
TAGS: *.c *.h
etags $^ $>
# implicit rules
.o.so:
$(CC) -shared $^ $> $(LIBS) -Wl,-S,-soname,$@ -o $@
.c.o:
$(CC) -c $< $(DEFS) $(CFLAGS) -o $@
# dependencies
datindex.o: datindex.c datindex.h read.h read2ch.h
digest.o: digest.c digest.h read.h read2ch.h r2chhtml.h
read.o: read.c read2ch.h datindex.h digest.h read.h r2chhtml.h