4 # NOTE: This top-level Makefile must not
5 # use GNU-make extensions. The lower ones can.
11 MFLAGS += --no-print-directory
13 # The version of GNU Make is too old, don't use it (.FEATURES variable was
16 $(error The build system requires GNU Make 3.81 or later.)
19 export DESTDIR := $(R)
21 # And over-ride all of the other magic.
22 include scripts/boiler.mk
24 test: build.raddb ${BUILD_DIR}/bin/radiusd ${BUILD_DIR}/bin/radclient
25 @$(MAKE) -C raddb/certs
26 @./build/make/jlibtool --mode=execute ./build/bin/radiusd -XCd ./raddb/ -n debug -D ./share
27 @$(MAKE) -C src/tests tests
29 # Tests specifically for Travis. We do a LOT more than just
31 ifneq "$(findstring travis,${prefix})" ""
38 # The $(R) is a magic variable not defined anywhere in this source.
39 # It's purpose is to allow an admin to create an installation 'tar'
40 # file *without* actually installing it. e.g.:
42 # $ R=/home/root/tmp make install
44 # $ tar -cf ~/freeradius-package.tar *
46 # The 'tar' file can then be un-tar'd on any similar machine. It's a
47 # cheap way of creating packages, without using a package manager.
48 # Many of the platform-specific packaging tools use the $(R) variable
49 # when creating their packages.
51 # For compatibility with typical GNU packages (e.g. as seen in libltdl),
52 # we make sure DESTDIR is defined.
54 export DESTDIR := $(R)
56 .PHONY: install.bindir
58 @[ -d $(R)$(bindir) ] || $(INSTALL) -d -m 755 $(R)$(bindir)
60 .PHONY: install.sbindir
62 @[ -d $(R)$(sbindir) ] || $(INSTALL) -d -m 755 $(R)$(sbindir)
65 install.dirs: install.bindir install.sbindir
66 @$(INSTALL) -d -m 755 $(R)$(mandir)
67 @$(INSTALL) -d -m 755 $(R)$(RUNDIR)
68 @$(INSTALL) -d -m 700 $(R)$(logdir)
69 @$(INSTALL) -d -m 700 $(R)$(radacctdir)
70 @$(INSTALL) -d -m 755 $(R)$(datadir)
71 @$(INSTALL) -d -m 755 $(R)$(dictdir)
73 DICTIONARIES := $(wildcard share/dictionary*)
74 install.share: $(addprefix $(R)$(dictdir)/,$(notdir $(DICTIONARIES)))
76 $(R)$(dictdir)/%: share/%
77 @echo INSTALL $(notdir $<)
78 @$(INSTALL) -m 644 $< $@
80 MANFILES := $(wildcard man/man*/*.?)
81 install.man: $(subst man/,$(R)$(mandir)/,$(MANFILES))
83 $(R)$(mandir)/%: man/%
84 @echo INSTALL $(notdir $<)
85 @$(INSTALL) -m 644 $< $@
87 install: install.dirs install.share install.man
93 chown -R $(RADMIN) $(R)$(raddbdir)
94 chgrp -R $(RGROUP) $(R)$(raddbdir)
95 chmod u=rwx,g=rx,o= `find $(R)$(raddbdir) -type d -print`
96 chmod u=rw,g=r,o= `find $(R)$(raddbdir) -type f -print`
97 chown -R $(RADMIN) $(R)$(logdir)
98 chgrp -R $(RGROUP) $(R)$(logdir)
99 find $(R)$(logdir) -type d -exec chmod u=rwx,g=rwx,o= {} \;
100 find $(R)$(logdir) -type d -exec chmod g+s {} \;
101 find $(R)$(logdir) -type f -exec chmod u=rw,g=rw,o= {} \;
102 chown -R $(RADMIN) $(R)$(RUNDIR)
103 chgrp -R $(RGROUP) $(R)$(RUNDIR)
104 find $(R)$(RUNDIR) -type d -exec chmod u=rwx,g=rwx,o= {} \;
105 find $(R)$(RUNDIR) -type d -exec chmod g+s {} \;
106 find $(R)$(RUNDIR) -type f -exec chmod u=rw,g=rw,o= {} \;
111 @-find src/modules -regex .\*/config[.][^.]*\$ -delete
112 @rm -f config.cache config.log config.status libtool \
113 src/include/radpaths.h src/include/stamp-h \
114 libltdl/config.log libltdl/config.status \
116 @-find . ! -name configure.in -name \*.in -print | \
118 while read file; do rm -f $$file; done
120 ######################################################################
122 # Automatic remaking rules suggested by info:autoconf#Automatic_Remaking
124 ######################################################################
125 CONFIGURE_IN_FILES := $(shell find . -name configure.in -print)
126 CONFIGURE_FILES := $(patsubst %.in,%,$(CONFIGURE_IN_FILES))
128 # If we've already run configure, then add rules which cause the
129 # module-specific "all.mk" files to depend on the mk.in files, and on
130 # the configure script.
132 ifneq "$(wildcard config.log)" ""
133 CONFIGURE_ARGS := $(shell head -10 config.log | grep '^ \$$' | sed 's/^....//;s:.*configure ::')
135 src/%all.mk: src/%all.mk.in src/%configure
136 @echo CONFIGURE $(dir $@)
137 @cd $(dir $<) && ./configure $(CONFIGURE_ARGS)
141 # The GNU tools make autoconf=="missing autoconf", which then returns
142 # 0, even when autoconf doesn't exist. This check is to ensure that
143 # we run AUTOCONF only when it exists.
145 #AUTOCONF_EXISTS := $(shell autoconf --version 2>/dev/null)
147 ifneq "$(AUTOCONF_EXISTS)" ""
148 # Configure files depend on "in" files, and on the top-level macro files
149 # If there are headers, run auto-header, too.
150 src/%configure: src/%configure.in acinclude.m4 aclocal.m4 $(wildcard $(dir $@)m4/*m4) | src/freeradius-devel
151 @echo AUTOCONF $(dir $@)
152 cd $(dir $@) && $(AUTOCONF) -I $(top_builddir) -I $(top_builddir)/m4 -I $(top_builddir)/$(dir $@)m4
153 @if grep AC_CONFIG_HEADERS $@ >/dev/null; then\
155 cd $(dir $@) && $(AUTOHEADER); \
158 # "%configure" doesn't match "configure"
159 configure: configure.in $(wildcard ac*.m4)
163 src/include/autoconf.h.in: configure.in
168 reconfig: $(CONFIGURE_FILES) src/include/autoconf.h.in
170 config.status: configure
171 ./config.status --recheck
173 .PHONY: check-includes
175 scripts/min-includes.pl `find . -name "*.c" -print`
179 etags `find src -type f -name '*.[ch]' -print` > $@
182 # Make test certificates.
186 @cd raddb/certs && $(MAKE)
188 ######################################################################
192 # Note that "Make.inc" has to be updated with the release number
193 # BEFORE running this command!
195 ######################################################################
196 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz: .git
197 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/ stable | gzip > $@
199 freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz
200 gpg --default-key aland@freeradius.org -b $<
202 freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2: .git
203 git archive --format=tar --prefix=freeradius-server-$(RADIUSD_VERSION_STRING)/ stable | bzip2 > $@
205 freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig: freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
206 gpg --default-key aland@freeradius.org -b $<
210 dist-check: redhat/freeradius.spec suse/freeradius.spec debian/changelog
211 @if [ `grep ^Version: redhat/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION_STRING)" ]; then \
212 cat redhat/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION_STRING)/' > redhat/.foo; \
213 mv redhat/.foo redhat/freeradius.spec; \
214 echo redhat/freeradius.spec 'Version' needs to be updated; \
217 @if [ `grep ^Version: suse/freeradius.spec | sed 's/.*://;s/ //'` != "$(RADIUSD_VERSION_STRING)" ]; then \
218 cat suse/freeradius.spec | sed 's/^Version: .*/Version: $(RADIUSD_VERSION_STRING)/' > suse/.foo; \
219 mv suse/.foo suse/freeradius.spec; \
220 echo suse/freeradius.spec 'Version' needs to be updated; \
223 @if [ `head -n 1 debian/changelog | sed 's/.*(//;s/-0).*//;s/-1).*//;'` != "$(RADIUSD_VERSION_STRING)" ]; then \
224 echo debian/changelog needs to be updated; \
228 dist: dist-check freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
230 dist-sign: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz.sig freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2.sig
232 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
233 scp $^ freeradius.org@ns5.freeradius.org:public_ftp
234 scp $^ freeradius.org@www.tr.freeradius.org:public_ftp
237 # Note that we do NOT do the tagging here! We just print out what
240 dist-tag: freeradius-server-$(RADIUSD_VERSION_STRING).tar.gz freeradius-server-$(RADIUSD_VERSION_STRING).tar.bz2
241 @echo "git tag release_`echo $(RADIUSD_VERSION_STRING) | tr .- __`"
244 # Build a debian package
248 fakeroot dpkg-buildpackage -b -uc
253 @(make clean all 2>&1) | egrep -v '^/|deprecated|^In file included|: In function| from |^HEADER|^CC|^LINK' > warnings.txt