-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathMakefile.in
168 lines (112 loc) · 3.71 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
# Makefile.in for pnscan
#
# @configure_input@
# Some 'make' variants does not include CPPFLAGS when compiling, some do
.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
DESTDIR =
srcdir = @srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
bindir = @bindir@
mandir = @mandir@
man1dir = ${mandir}/man1
CC = @CC@
INSTALL = @INSTALL@
TAR = tar
PACKAGE = @PACKAGE_TARNAME@
VERSION = @PACKAGE_VERSION@
CPPFLAGS = @CPPFLAGS@ -I. -I${srcdir}
CFLAGS = -pthread -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
@SET_MAKE@
VALGRIND = valgrind
VALGRINDFLAGS = --leak-check=full --track-origins=yes --error-exitcode=1 # --show-leak-kinds=all
DISTCHECKDIR = /tmp/distcheck-$(PACKAGE)-$(VERSION)
DISTDIR = /tmp/build-$(PACKAGE)-$(VERSION)
PBINS = pnscan
POBJS = pnscan.o bm.o
TBINS = t_listen
TOBJS = t_listen.o
BINS = $(PBINS) $(TBINS)
all: $(BINS) Makefile
Makefile: Makefile.in config.status
./config.status
config.h: config.h.in config.status
./config.status
pnscan: $(POBJS)
$(CC) $(LDFLAGS) -o pnscan $(POBJS) $(LIBS)
pnscan.o: pnscan.c bm.h
bm.o: bm.c bm.h
t_listen: t_listen.o
$(CC) $(LDFLAGS) -o t_listen $(TOBJS) $(LIBS)
# Clean targets
maintainer-clean: distclean
rm -f configure config.h.in
distclean: clean
rm -fr config.status config.log stamp-h1 .deps autom4te.cache Makefile config.h *.tar.gz
(cd pkgs && $(MAKE) distclean)
clean mostlyclean:
-rm -f *~ \#* *.o *.o core *.core vgcore.* $(BINS)
# Git targets
push: distclean
git add -A && git commit -a && git push
pull:
git pull
# Install targets
install install-all: install-bin install-man
install-strip: install-strip-bin install-man
install-bin: $(PBINS)
$(INSTALL) -d "$(DESTDIR)$(bindir)"
$(INSTALL) $(PBINS) "$(DESTDIR)$(bindir)"
install-strip-bin: $(PBINS)
$(INSTALL) -d "$(DESTDIR)$(bindir)"
$(INSTALL) -s $(PBINS) "$(DESTDIR)$(bindir)"
install-man: pnscan.1
-$(INSTALL) -d "$(DESTDIR)$(man1dir)"
-$(INSTALL) pnscan.1 "$(DESTDIR)$(man1dir)" && \
gzip -f "$(DESTDIR)$(man1dir)/pnscan.1"
uninstall-all uninstall: uninstall-bin uninstall-man
uninstall-bin:
rm -f "$(DESTDIR)$(bindir)/pnscan"
uninstall-man:
test -d "$(TESTDIR)$(man1dir)" && rm -f "$(DESTDIR)$(man1dir)"/pnscan.1 "$(DESTDIR)$(man1dir)"/pnscan.1.gz
CHECKCMD = ./pnscan
# Check targets
check: check-simple check-verbose check-hostname check-response check-response-fail
check-simple: $(BINS)
$(CHECKCMD) 127.0.0.1 `./t_listen`
check-verbose: $(BINS)
$(CHECKCMD) -v 127.0.0.1 `./t_listen`
check-hostname: $(BINS)
$(CHECKCMD) -s 127.0.0.1 `./t_listen`
check-response: $(BINS)
$(CHECKCMD) -r "Hello" 127.0.0.1 `./t_listen`
check-response-fail: $(BINS)
$(CHECKCMD) -r "Hejsan" 127.0.0.1 `./t_listen`
check-valgrind:
$(MAKE) CHECKCMD="$(VALGRIND) $(CHECKCMD)" check
distcheck: $(PACKAGE)-$(VERSION).tar.gz
@if test -d "$(DISTCHECKDIR)"; then \
chmod -R +w "$(DISTCHECKDIR)" && rm -fr "$(DISTCHECKDIR)"; \
fi;
mkdir -p "$(DISTCHECKDIR)" && \
gunzip <"$(PACKAGE)-$(VERSION).tar.gz" | \
(cd "$(DISTCHECKDIR)" && $(TAR) xf - && \
chmod -R -w "$(PACKAGE)-$(VERSION)" && \
mkdir b && cd b && ../$(PACKAGE)-$(VERSION)/configure && \
$(MAKE) && $(MAKE) -s check) && echo "*** distcheck: OK"
@chmod -R +w "$(DISTCHECKDIR)" && rm -fr "$(DISTCHECKDIR)";
# Dist targets
dist: $(PACKAGE)-$(VERSION).tar.gz
$(PACKAGE)-$(VERSION).tar.gz: Makefile
rm -fr "$(DISTDIR)" && mkdir -p "$(DISTDIR)/$(PACKAGE)-$(VERSION)" && \
cp -r * "$(DISTDIR)/$(PACKAGE)-$(VERSION)" && \
(cd "$(DISTDIR)/$(PACKAGE)-$(VERSION)" && $(MAKE) distclean)
(cd "$(DISTDIR)" && $(TAR) cvf - "$(PACKAGE)-$(VERSION)") | gzip >"$(PACKAGE)-$(VERSION)".tar.gz
echo rm -fr "$(DISTDIR)"
@echo ""
@echo "*** $(PACKAGE)-$(VERSION).tar.gz created"