forked from FreeRADIUS/freeradius-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
256 lines (218 loc) · 7.71 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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#
# Makefile
#
# NOTE: This top-level Makefile must not
# use GNU-make extensions. The lower ones can.
#
# Version: $Id$
#
include Make.inc
MFLAGS += --no-print-directory
# Speed up the build for developers. This means editing Make.inc,
# and adding "BOILER = yes" to the bottom. Once that's done, the
#
#
ifeq "$(BOILER)" "yes"
# Require at least GNU Make 3.81 for the new build system
# Don't allow 3.80. Allow any 3.8x. This will need to be changed
# in a decade or two when GNU Make 3.90 is released.
BOILERMAKE=$(subst 3.8,yes,$(subst 3.80,,$(MAKE_VERSION)))
# The version of GNU Make is too old, don't use it.
ifeq "" "$(findstring yes,$(BOILERMAKE))"
BOILERMAKE=
endif
# Static-only builds still require libtool.
# This is because it does all kinds of preload magic in order
# to force the linker to put the libraries into the main binary.
# We don't support that yet, so we miss it...
ifneq "$(USE_SHARED_LIBS)" "yes"
BOILERMAKE=
endif
endif
# If possible, drastically decrease the build time.
# The new build system means that
ifneq "" "$(BOILERMAKE)"
# Don't use libtool or libltdl.
# They are a blight upon the face of the earth.
LIBLTDL :=
INCLTDL := -DWITH_DLOPEN
CFLAGS += -DWITHOUT_LIBLTDL
LIBTOOL := JLIBTOOL
LTDL_SUBDIRS :=
export DESTDIR := $(R)
# And over-ride all of the other magic.
include scripts/boiler.mk
else
.PHONY: all clean install
SUBDIRS = $(LTDL_SUBDIRS) $(wildcard src raddb scripts doc)
WHAT_TO_MAKE = all
all:
@$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
clean:
@$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
@rm -f *~
endif
.PHONY: tests
tests:
@$(MAKE) -C src/tests tests
#
# The $(R) is a magic variable not defined anywhere in this source.
# It's purpose is to allow an admin to create an installation 'tar'
# file *without* actually installing it. e.g.:
#
# $ R=/home/root/tmp make install
# $ cd /home/root/tmp
# $ tar -cf ~/freeradius-package.tar *
#
# The 'tar' file can then be un-tar'd on any similar machine. It's a
# cheap way of creating packages, without using a package manager.
# Many of the platform-specific packaging tools use the $(R) variable
# when creating their packages.
#
# For compatibility with typical GNU packages (e.g. as seen in libltdl),
# we make sure DESTDIR is defined.
#
export DESTDIR := $(R)
ifeq "$(BOILERMAKE)" ""
install:
$(INSTALL) -d -m 755 $(R)$(sbindir)
$(INSTALL) -d -m 755 $(R)$(bindir)
$(INSTALL) -d -m 755 $(R)$(raddbdir)
$(INSTALL) -d -m 755 $(R)$(mandir)
$(INSTALL) -d -m 755 $(R)$(RUNDIR)
$(INSTALL) -d -m 700 $(R)$(logdir)
$(INSTALL) -d -m 700 $(R)$(radacctdir)
$(INSTALL) -d -m 755 $(R)$(datadir)
$(INSTALL) -d -m 755 $(R)$(dictdir)
for i in 1 5 8; do \
$(INSTALL) -d -m 755 $(R)$(mandir)/man$$i; \
for p in man/man$$i/*.$$i; do \
$(INSTALL) -m 644 $$p $(R)$(mandir)/man$$i; \
done \
done
@$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
@echo "Installing dictionary files in $(R)$(dictdir)"; \
cd share; \
for i in dictionary*; do \
$(INSTALL) -m 644 $$i $(R)$(dictdir); \
done
$(LIBTOOL) --finish $(R)$(libdir)
endif
ifneq ($(RADMIN),)
ifneq ($(RGROUP),)
.PHONY: install-chown
install-chown:
chown -R $(RADMIN) $(R)$(raddbdir)
chgrp -R $(RGROUP) $(R)$(raddbdir)
chmod u=rwx,g=rx,o= `find $(R)$(raddbdir) -type d -print`
chmod u=rw,g=r,o= `find $(R)$(raddbdir) -type f -print`
chown -R $(RADMIN) $(R)$(logdir)
chgrp -R $(RGROUP) $(R)$(logdir)
find $(R)$(logdir) -type d -exec chmod u=rwx,g=rwx,o= {} \;
find $(R)$(logdir) -type d -exec chmod g+s {} \;
find $(R)$(logdir) -type f -exec chmod u=rw,g=rw,o= {} \;
chown -R $(RADMIN) $(R)$(RUNDIR)
chgrp -R $(RGROUP) $(R)$(RUNDIR)
find $(R)$(RUNDIR) -type d -exec chmod u=rwx,g=rwx,o= {} \;
find $(R)$(RUNDIR) -type d -exec chmod g+s {} \;
find $(R)$(RUNDIR) -type f -exec chmod u=rw,g=rw,o= {} \;
endif
endif
.PHONY: common $(SUBDIRS)
common: $(SUBDIRS)
$(SUBDIRS):
@echo "Making $(WHAT_TO_MAKE) in $@..."
@$(MAKE) $(MFLAGS) -C $@ $(WHAT_TO_MAKE)
distclean: clean
rm -f config.cache config.log config.status libtool \
src/include/radpaths.h src/include/stamp-h \
libltdl/config.log libltdl/config.status \
libltdl/libtool
-find . ! -name configure.in -name \*.in -print | \
sed 's/\.in$$//' | \
while read file; do rm -f $$file; done
-find src/modules -name config.mak | \
while read file; do rm -f $$file; done
-find src/modules -name config.h | \
while read file; do rm -f $$file; done
######################################################################
#
# Automatic remaking rules suggested by info:autoconf#Automatic_Remaking
#
######################################################################
.PHONY: reconfig
reconfig:
@$(MAKE) $(MFLAGS) -C src reconfig
@$(MAKE) configure
@$(MAKE) src/include/autoconf.h.in
configure: configure.in aclocal.m4
$(AUTOCONF)
.PHONY: src/include/autoconf.h.in
src/include/autoconf.h.in:
$(AUTOHEADER)
config.status: configure
./config.status --recheck
configure.in:
.PHONY: check-includes
check-includes:
scripts/min-includes.pl `find . -name "*.c" -print`
TAGS:
etags `find src -type f -name '*.[ch]' -print`
#
# Make test certificates.
#
.PHONY: certs
certs:
@cd raddb/certs && $(MAKE)
######################################################################
#
# Make a release.
#
# Note that "Make.inc" has to be updated with the release number
# BEFORE running this command!
#
######################################################################
freeradius-server-$(RADIUSD_VERSION).tar.gz: .git
git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ stable | gzip > $@
freeradius-server-$(RADIUSD_VERSION).tar.gz.sig: freeradius-server-$(RADIUSD_VERSION).tar.gz
gpg --default-key [email protected] -b $<
freeradius-server-$(RADIUSD_VERSION).tar.bz2: .git
git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION)/ stable | bzip2 > $@
freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig: freeradius-server-$(RADIUSD_VERSION).tar.bz2
gpg --default-key [email protected] -b $<
# high-level targets
.PHONY: dist-check
dist-check: redhat/freeradius.spec suse/freeradius.spec debian/changelog
@if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \
cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > redhat/.foo; \
mv redhat/.foo redhat/freeradius.spec; \
echo redhat/freeradius.spec 'Version' needs to be updated; \
exit 1; \
fi
@if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION)" ]; then \
cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION)/' > suse/.foo; \
mv suse/.foo suse/freeradius.spec; \
echo suse/freeradius.spec 'Version' needs to be updated; \
exit 1; \
fi
@if [ `head -n 1 debian/changelog | sed 's/.*(//;s/-0).*//;s/-1).*//;'` != "$(RADIUSD_VERSION)" ]; then \
echo debian/changelog needs to be updated; \
exit 1; \
fi
dist: dist-check freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2
dist-sign: freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig
dist-publish: freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2 freeradius-server-$(RADIUSD_VERSION).tar.gz.sig freeradius-server-$(RADIUSD_VERSION).tar.bz2.sig
scp $^ [email protected]:public_ftp
scp $^ [email protected]:public_ftp
#
# Note that we do NOT do the tagging here! We just print out what
# to do!
#
dist-tag: freeradius-server-$(RADIUSD_VERSION).tar.gz freeradius-server-$(RADIUSD_VERSION).tar.bz2
@echo "git tag release_`echo $(RADIUSD_VERSION) | tr .- __`"
#
# Build a debian package
#
.PHONY: deb
deb:
fakeroot dpkg-buildpackage -b -uc