forked from PhirePhly/aprx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
225 lines (175 loc) · 6.36 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
221
222
223
#
# APRX -- 2nd generation receive-only APRS-i-gate with
# minimal requirement of esoteric facilities or
# libraries of any kind beyond UNIX system libc.
#
# Note: This makefile uses features from GNU make
# -------------------------------------------------------------------- #
# target paths
VARRUN= /var/run/aprx # directory for aprx.state and pid-file
VARLOG= /var/log/aprx # directory for direct logfiles
CFGFILE= @sysconfdir@/aprx.conf # default configuration file
SBINDIR= @sbindir@ # installation path for programs
MANDIR= @mandir@ # installation path for manual pages
# -------------------------------------------------------------------- #
srcdir = @srcdir@
VPATH = @srcdir@
@SET_MAKE@
PROF= # used by 'make profile'
# Compiler and flags
CC= @CC@
CFLAGS= @CFLAGS@ @CCPTHREAD@
# Linker and flags
LD= @CC@
LDFLAGS= @LDFLAGS@ $(PROF)
datarootdir= @datarootdir@
INSTALL= $(srcdir)/install-sh
INSTALL_PROGRAM=$(INSTALL)
INSTALL_DATA= $(INSTALL) -m 644
# -------------------------------------------------------------------- #
# no user serviceable parts below
# -------------------------------------------------------------------- #
# strip extra whitespace from paths
VARRUN:=$(strip $(VARRUN))
VARLOG:=$(strip $(VARLOG))
CFGFILE:=$(strip $(CFGFILE))
SBINDIR:=$(strip $(SBINDIR))
MANDIR:=$(strip $(MANDIR))
# generate version strings
VERSION = @VERSION_STRING@
SCMVERSION = $(shell git rev-parse --short HEAD)
ifneq ($(shell cat SCMVERSION),$(SCMVERSION))
RC := $(shell echo $(SCMVERSION) >SCMVERSION)
endif
SCMREVCOUNT = $(shell git rev-list HEAD --count)
DATE:=$(shell date +"%Y %B %d")
RFCDATE:=$(shell date +"%a, %d %b %Y %H:%M:%S %z")
DEFS= -DAPRXVERSION="\"@VERSION_STRING@g$(SCMVERSION)\"" \
-DVARRUN="\"$(VARRUN)\"" -DVARLOG="\"$(VARLOG)\"" \
-DCFGFILE="\"$(CFGFILE)\""
# program names
PROGAPRX= aprx
PROGSTAT= $(PROGAPRX)-stat
LIBS= @LIBS@ @LIBRESOLV@ @LIBSOCKET@ @LIBM@ @LIBPTHREAD@ @LIBGETADDRINFO@ @LIBRT@
OBJSAPRX= aprx.o ttyreader.o ax25.o aprsis.o beacon.o config.o \
netax25.o erlang.o aprxpolls.o telemetry.o igate.o \
cellmalloc.o historydb.o keyhash.o parse_aprs.o \
dupecheck.o kiss.o interface.o pbuf.o digipeater.o \
valgrind.o filter.o dprsgw.o crc.o agwpesocket.o \
netresolver.o timercmp.o #ssl.o
OBJSSTAT= erlang.o aprx-stat.o aprxpolls.o valgrind.o timercmp.o
# man page sources, will be installed as $(PROGAPRX).8 / $(PROGSTAT).8
MANAPRX := aprx.8
MANSTAT := aprx-stat.8
OBJS= $(OBJSAPRX) $(OBJSSTAT)
MAN= $(MANAPRX) $(MANSTAT)
# -------------------------------------------------------------------- #
.PHONY: all
all: $(PROGAPRX) $(PROGSTAT) man aprx.conf aprx-complex.conf \
apparmor.aprx
valgrind:
@echo "Did you do 'make clean' before 'make valgrind' ?"
make all CFLAGS="${CFLAGS} -D_FOR_VALGRIND_"
profile:
@echo "Did you do 'make clean' before 'make profile' ?"
make all PROF="-pg"
$(PROGAPRX): $(OBJSAPRX) VERSION Makefile SCMVERSION
$(LD) $(LDFLAGS) -o $@ $(OBJSAPRX) $(LIBS)
$(PROGSTAT): $(OBJSSTAT) VERSION Makefile SCMVERSION
$(LD) $(LDFLAGS) -o $@ $(OBJSSTAT) $(LIBS)
.PHONY: man
man: $(MAN)
.PHONY: doc html pdf
doc: html pdf
pdf: $(MAN:=.pdf)
html: $(MAN:=.html)
# -------------------------------------------------------------------- #
.PHONY: install install-deb
install: all
$(INSTALL_PROGRAM) -m 6755 $(PROGAPRX) $(DESTDIR)$(SBINDIR)/$(PROGAPRX)
$(INSTALL_PROGRAM) -m 755 $(PROGSTAT) $(DESTDIR)$(SBINDIR)/$(PROGSTAT)
$(INSTALL_DATA) $(MANAPRX) $(DESTDIR)$(MANDIR)/man8/$(PROGAPRX).8
$(INSTALL_DATA) $(MANSTAT) $(DESTDIR)$(MANDIR)/man8/$(PROGSTAT).8
if [ ! -f $(DESTDIR)$(CFGFILE) ] ; then \
$(INSTALL_DATA) aprx.conf $(DESTDIR)$(CFGFILE) ; \
else true ; fi
.PHONY: clean
clean:
rm -f $(PROGAPRX) $(PROGSTAT)
rm -f $(MAN) $(MAN:=.html) $(MAN:=.ps) $(MAN:=.pdf) \
rm -f aprx.conf logrotate.aprx
rm -f *~ *.o *.d
.PHONY: distclean
distclean: clean
rm -f config.log config.status config.h
rm -rf autom4te.cache *.log* doc/.~*#
# -------------------------------------------------------------------- #
%.o: %.c VERSION SCMVERSION Makefile
$(CC) $(CFLAGS) $(PROF) $(DEFS) -c $<
@$(CC) -MM $(CFLAGS) $(PROF) $(DEFS) $< > $(@:.o=.d)
$(MAN:=.html): %.html : %
sh man-to-html.sh $< > $@
$(MAN:=.ps): %.ps : %
groff -man $< > $@
$(MAN:=.pdf): %.pdf : %.ps
ps2pdf $<
logrotate.aprx $(MAN) aprx-complex.conf aprx.conf apparmor.aprx: \
% : %.in VERSION Makefile
perl -ne "s{\@DATEVERSION\@}{$(VERSION) - $(DATE)}g; \
s{\@VARRUN\@}{$(VARRUN)}g; \
s{\@VARLOG\@}{$(VARLOG)}g; \
s{\@CFGFILE\@}{$(CFGFILE)}g; \
print;" \
< $< > $@
# -------------------------------------------------------------------- #
#
# Following is for the original author only...
#
DISTVERSION:=aprx-$(VERSION).git$(SCMVERSION)
DISTTARGET:=../$(DISTVERSION)
RPMVERSION:=$(shell echo "${DISTVERSION}" | sed -e 's/aprx-//')
.PHONY: dist
dist:
if [ ! -d $(DISTTARGET) ] ; then \
mkdir $(DISTTARGET) ; \
fi
tar cf - --exclude-backups --exclude-vcs --exclude=windows --exclude=*.log* --exclude=*.conf . | (cd $(DISTTARGET) ; tar xf -)
echo "$(DISTVERSION)" > $(DISTTARGET)/VERSION
perl -ne "\$$ver = '$(DISTVERSION)'; \
\$$ver =~ tr/0-9.//cd; \
\$$ver .= '-1'; \
s{\@VERSION\@}{\$$ver}g; \
s{\@RFCDATE\@}{$(RFCDATE)}g; \
print;" \
< $(DISTTARGET)/debian/changelog.release \
> $(DISTTARGET)/debian/changelog
rm -f $(DISTTARGET)/debian/changelog.release
rm -f $(DISTTARGET)/aprx.spec
perl -ne "s{\@VERSION\@}{$(RPMVERSION)}g; \
s{\@DATE0\@}{$(DATE0)}g; \
print;" \
< $(DISTTARGET)/rpm/aprx.spec.in \
> $(DISTTARGET)/aprx.spec
rm -f $(DISTTARGET)/rpm/aprx.spec.in
make -C $(DISTTARGET) distclean
cd .. && \
tar czvf $(DISTVERSION).tar.gz $(DISTVERSION)
# -------------------------------------------------------------------- #
.PHONY: make-deb make-rpm
make-deb:
if [ -f debian/changelog.release ] ; then \
perl -ne "\$$ver = '$(VERSION)'; \
\$$ver .= '.'; \
\$$ver .= '$(SCMREVCOUNT)'; \
s{\@VERSION\@}{\$$ver}g; \
s{\@RFCDATE\@}{$(RFCDATE)}g; \
print;" \
< debian/changelog.release \
> debian/changelog ; \
fi
dpkg-buildpackage -b -us -uc -rfakeroot
make-rpm: # actually just a reminder of how to do it..
rpmbuild --target i386 -ta ../$(DISTVERSION).tar.gz
# -------------------------------------------------------------------- #
# include object depencies if available
-include $(OBJS:.o=.d)