-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (68 loc) · 2.21 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
preloaddir = $(libdir)
datarootdir = $(prefix)/share
mandir = $(datarootdir)/man
man1dir = $(mandir)/man1
CC = gcc
CFLAGS = -g -O2 -W -Wall -Wmissing-prototypes
INSTALL = install
# Tools used for 'make check'
CURL = curl
WGET = wget
JAVA = java
JAVAC = javac
PYTHON = python3
distname = islandhack-0.5
distfiles = islandhack islandhack-io.c islandhack.1 README COPYING Makefile \
test-client.sh geturl.java geturl.py example.cache
library = libislandhack.so.0
all: $(library)
chmod a+x islandhack
$(library): islandhack-io.o
$(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(library) \
-o $(library) islandhack-io.o -ldl
islandhack-io.o: islandhack-io.c
$(CC) $(CFLAGS) $(CPPFLAGS) -fpic -c islandhack-io.c
clean:
rm -f *.o *.so $(library)
rm -f islandhack.tmp
rm -rf *.class tmpcache*
install: islandhack $(library)
$(INSTALL) -d $(DESTDIR)$(libdir)
$(INSTALL) -m 644 $(library) $(DESTDIR)$(libdir)
$(INSTALL) -d $(DESTDIR)$(bindir)
if [ -n "$(preloaddir)" ]; then \
sed 's|my $$PKGLIBDIR = .*;|my $$PKGLIBDIR = q<$(preloaddir)>;|' \
< islandhack > islandhack.tmp ; \
else \
sed 's|my $$PKGLIBDIR = .*;|my $$PKGLIBDIR;|' \
< islandhack > islandhack.tmp ; \
fi
$(INSTALL) -m 755 islandhack.tmp $(DESTDIR)$(bindir)/islandhack
rm -f islandhack.tmp
$(INSTALL) -d $(DESTDIR)$(man1dir)
$(INSTALL) -m 644 islandhack.1 $(DESTDIR)$(man1dir)
uninstall:
rm -f $(DESTDIR)$(bindir)/islandhack
rm -f $(DESTDIR)$(libdir)/$(library)
rm -f $(DESTDIR)$(man1dir)/islandhack.1
check: check-wget check-curl check-java check-python
check-wget: all
sh test-client.sh ./islandhack tmpcache-wget "$(WGET) -O -"
check-curl: all
sh test-client.sh ./islandhack tmpcache-curl "$(CURL) -f"
check-java: all
$(JAVAC) $(JAVACFLAGS) geturl.java
sh test-client.sh ./islandhack tmpcache-java "$(JAVA) -cp . geturl"
check-python: all
sh test-client.sh ./islandhack tmpcache-python "$(PYTHON) ./geturl.py"
dist:
rm -rf $(distname)
mkdir $(distname)
cp -pr $(distfiles) $(distname)
tar cv $(distname) | gzip -9 > $(distname).tar.gz
.PHONY: all clean install uninstall dist check \
check-wget check-curl check-java check-python