4 # NOTE: This top-level Makefile must not
5 # use GNU-make extensions. The lower ones can.
10 $(if $(wildcard Make.inc),,$(error Missing 'Make.inc' Run './configure [options]' and retry"))
14 MFLAGS += --no-print-directory
16 # The version of GNU Make is too old, don't use it (.FEATURES variable was
19 $(error The build system requires GNU Make 3.81 or later.)
22 export DESTDIR := $(R)
24 # And over-ride all of the other magic.
25 include scripts/boiler.mk
27 test: build.raddb ${BUILD_DIR}/bin/radiusd ${BUILD_DIR}/bin/radclient
28 @$(MAKE) -C raddb/certs
29 @./build/make/jlibtool --mode=execute ./build/bin/radiusd -XCdM ./raddb -n debug -D ./share
30 @$(MAKE) -C src/tests tests
32 # Tests specifically for Travis. We do a LOT more than just
34 ifneq "$(findstring travis,${prefix})" ""
41 # The $(R) is a magic variable not defined anywhere in this source.
42 # It's purpose is to allow an admin to create an installation 'tar'
43 # file *without* actually installing it. e.g.:
45 # $ R=/home/root/tmp make install
47 # $ tar -cf ~/freeradius-package.tar *
49 # The 'tar' file can then be un-tar'd on any similar machine. It's a
50 # cheap way of creating packages, without using a package manager.
51 # Many of the platform-specific packaging tools use the $(R) variable
52 # when creating their packages.
54 # For compatibility with typical GNU packages (e.g. as seen in libltdl),
55 # we make sure DESTDIR is defined.
57 export DESTDIR := $(R)
59 .PHONY: install.bindir
61 @[ -d $(R)$(bindir) ] || $(INSTALL) -d -m 755 $(R)$(bindir)
63 .PHONY: install.sbindir
65 @[ -d $(R)$(sbindir) ] || $(INSTALL) -d -m 755 $(R)$(sbindir)
68 install.dirs: install.bindir install.sbindir
69 @$(INSTALL) -d -m 755 $(R)$(mandir)
70 @$(INSTALL) -d -m 755 $(R)$(RUNDIR)
71 @$(INSTALL) -d -m 700 $(R)$(logdir)
72 @$(INSTALL) -d -m 700 $(R)$(radacctdir)
73 @$(INSTALL) -d -m 755 $(R)$(datadir)
74 @$(INSTALL) -d -m 755 $(R)$(dictdir)
76 DICTIONARIES := $(wildcard share/dictionary*)
77 install.share: $(addprefix $(R)$(dictdir)/,$(notdir $(DICTIONARIES)))
79 $(R)$(dictdir)/%: share/%
80 @echo INSTALL $(notdir $<)
81 @$(INSTALL) -m 644 $< $@
83 MANFILES := $(wildcard man/man*/*.?)
84 install.man: $(subst man/,$(R)$(mandir)/,$(MANFILES))
86 $(R)$(mandir)/%: man/%
87 @echo INSTALL $(notdir $<)
88 @$(INSTALL) -m 644 $< $@
90 install: install.dirs install.share install.man
96 chown -R $(RADMIN) $(R)$(raddbdir)
97 chgrp -R $(RGROUP) $(R)$(raddbdir)
98 chmod u=rwx,g=rx,o= `find $(R)$(raddbdir) -type d -print`
99 chmod u=rw,g=r,o= `find $(R)$(raddbdir) -type f -print`
100 chown -R $(RADMIN) $(R)$(logdir)
101 chgrp -R $(RGROUP) $(R)$(logdir)
102 find $(R)$(logdir) -type d -exec chmod u=rwx,g=rwx,o= {} \;
103 find $(R)$(logdir) -type d -exec chmod g+s {} \;
104 find $(R)$(logdir) -type f -exec chmod u=rw,g=rw,o= {} \;
105 chown -R $(RADMIN) $(R)$(RUNDIR)
106 chgrp -R $(RGROUP) $(R)$(RUNDIR)
107 find $(R)$(RUNDIR) -type d -exec chmod u=rwx,g=rwx,o= {} \;
108 find $(R)$(RUNDIR) -type d -exec chmod g+s {} \;
109 find $(R)$(RUNDIR) -type f -exec chmod u=rw,g=rw,o= {} \;
114 @-find src/modules -regex .\*/config[.][^.]*\$$ -delete
115 @-find src/modules -name autom4te.cache -exec rm -rf '{}' \;
116 @rm -rf config.cache config.log config.status libtool \
117 src/include/radpaths.h src/include/stamp-h \
118 libltdl/config.log libltdl/config.status \
119 libltdl/libtool autom4te.cache build
120 @-find . ! -name configure.ac -name \*.in -print | \
122 while read file; do rm -f $$file; done
124 ######################################################################
126 # Automatic remaking rules suggested by info:autoconf#Automatic_Remaking
128 ######################################################################
130 # Do these checks ONLY if we're re-building the "configure"
131 # scripts, and ONLY the "configure" scripts. If we leave
132 # these rules enabled by default, then they're run too often.
134 ifeq "$(MAKECMDGOALS)" "reconfig"
136 CONFIGURE_IN_FILES := $(shell find . -name configure.ac -print)
137 CONFIGURE_FILES := $(patsubst %.in,%,$(CONFIGURE_IN_FILES))
140 # The GNU tools make autoconf=="missing autoconf", which then returns
141 # 0, even when autoconf doesn't exist. This check is to ensure that
142 # we run AUTOCONF only when it exists.
144 AUTOCONF_EXISTS := $(shell autoconf --version 2>/dev/null)
146 ifeq "$(AUTOCONF_EXISTS)" ""
147 $(error You need to install autoconf to re-build the "configure" scripts)
150 # Configure files depend on "in" files, and on the top-level macro files
151 # If there are headers, run auto-header, too.
152 src/%configure: src/%configure.ac acinclude.m4 aclocal.m4 $(wildcard $(dir $@)m4/*m4) | src/freeradius-devel
153 @echo AUTOCONF $(dir $@)
154 cd $(dir $@) && $(AUTOCONF) -I $(top_builddir) -I $(top_builddir)/m4 -I $(top_builddir)/$(dir $@)m4
155 @if grep AC_CONFIG_HEADERS $@ >/dev/null; then\
157 cd $(dir $@) && $(AUTOHEADER); \
160 # "%configure" doesn't match "configure"
161 configure: configure.ac $(wildcard ac*.m4) $(wildcard m4/*.m4)
165 src/include/autoconf.h.in: configure.ac
169 reconfig: $(CONFIGURE_FILES) src/include/autoconf.h.in
171 config.status: configure
172 ./config.status --recheck
174 # target is "configure"
177 # If we've already run configure, then add rules which cause the
178 # module-specific "all.mk" files to depend on the mk.in files, and on
179 # the configure script.
181 ifneq "$(wildcard config.log)" ""
182 CONFIGURE_ARGS := $(shell head -10 config.log | grep '^ \$$' | sed 's/^....//;s:.*configure ::')
184 src/%all.mk: src/%all.mk.in src/%configure
185 @echo CONFIGURE $(dir $@)
186 @cd $(dir $<) && ./configure $(CONFIGURE_ARGS)
189 .PHONY: check-includes
191 scripts/min-includes.pl `find . -name "*.c" -print`
195 etags `find src -type f -name '*.[ch]' -print` > $@
198 # Make test certificates.
202 @cd raddb/certs && $(MAKE)
204 ######################################################################
208 # Note that "Make.inc" has to be updated with the release number
209 # BEFORE running this command!
211 ######################################################################
212 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz: .git
213 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/ stable | gzip > $@
215 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz
216 gpg --default-key aland@freeradius.org -b $<
218 freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2: .git
219 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/ stable | bzip2 > $@
221 freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig: freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
222 gpg --default-key aland@freeradius.org -b $<
226 dist-check: redhat/freeradius.spec suse/freeradius.spec debian/changelog
227 @if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION_STRING)" ]; then \
228 cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION_STRING)/' > redhat/.foo; \
229 mv redhat/.foo redhat/freeradius.spec; \
230 echo redhat/freeradius.spec 'Version' needs to be updated; \
233 @if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION_STRING)" ]; then \
234 cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION_STRING)/' > suse/.foo; \
235 mv suse/.foo suse/freeradius.spec; \
236 echo suse/freeradius.spec 'Version' needs to be updated; \
239 @if [ `head -n 1 debian/changelog | sed 's/.*(//;s/-0).*//;s/-1).*//;'` != "$(RADIUSD_VERSION_STRING)" ]; then \
240 echo debian/changelog needs to be updated; \
244 dist: dist-check freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
246 dist-sign: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig
248 dist-publish: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig
249 scp $^ freeradius.org@ns5.freeradius.org:public_ftp
250 scp $^ freeradius.org@www.tr.freeradius.org:public_ftp
253 # Note that we do NOT do the tagging here! We just print out what
256 dist-tag: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
257 @echo "git tag release_`echo $(RADIUSD_VERSION_STRING) | tr .- __`"
260 # Build a debian package
264 fakeroot dpkg-buildpackage -b -uc
269 @(make clean all 2>&1) | egrep -v '^/|deprecated|^In file included|: In function| from |^HEADER|^CC|^LINK' > warnings.txt