backport from HEAD
[freeradius.git] / Makefile
index 90a9f2e..119a3a0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 #
-# Makefile     Makefile for the cistron-radius package.
+# Makefile
 #
 #              NOTE: This top-level Makefile must not
 #              use GNU-make extensions. The lower ones can.
@@ -9,7 +9,9 @@
 
 include Make.inc
 
-SUBDIRS                = src raddb doc scripts
+.PHONY: all clean install
+
+SUBDIRS                = ${LIBLTDLPATH} src raddb scripts doc
 WHAT_TO_MAKE   = all
 
 all:
@@ -19,25 +21,43 @@ clean:
        @$(MAKE) $(MFLAGS) WHAT_TO_MAKE=$@ common
        @rm -f *~
 
+#
+# 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.
+#
 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 700    $(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 "Creating/updating files in $(raddbdir)"; \
-       install -d -m 755       $(raddbdir); \
-       cd raddb; \
-       for i in [a-c]* [e-z]*; do \
-               [ ! -f $(raddbdir)/$$i ] && install -m 644 $$i $(raddbdir); \
-       done; \
+       @echo "Installing dictionary files in $(R)$(dictdir)"; \
+       cd share; \
        for i in dictionary*; do \
-               [ ! -f $(raddbdir)/$$i ] && install -m 644 $$i $(raddbdir); \
-               if [ $$i -nt $(raddbdir)/$$i ]; then \
-                       echo "** $(raddbdir)/$$i"; \
-                       nt=1; \
-               fi; \
-       done; \
-       if [ "$$nt" ]; then \
-               echo "** The samples in ../raddb are newer than these files";\
-               echo "** Please investigate and copy manually if appropriate";\
-       fi
+               $(INSTALL) -m 644 $$i $(R)$(dictdir); \
+       done
+       $(LIBTOOL) --finish $(R)$(libdir)
 
 common:
        @for dir in $(SUBDIRS); do \
@@ -46,7 +66,10 @@ common:
        done
 
 distclean: clean
-       rm -f config.cache config.log config.status
+       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
@@ -63,12 +86,12 @@ distclean: clean
 reconfig: configure src/include/autoconf.h.in
 
 configure: configure.in aclocal.m4
-       autoconf
+       $(AUTOCONF)
 
 # autoheader might not change autoconf.h.in, so touch a stamp file
 src/include/autoconf.h.in: src/include/stamp-h.in acconfig.h
 src/include/stamp-h.in: configure.in acconfig.h
-       autoheader
+       $(AUTOHEADER)
        echo timestamp > src/include/stamp-h.in
 
 src/include/autoconf.h: src/include/stamp-h
@@ -79,3 +102,6 @@ config.status: configure
        ./config.status --recheck
 
 configure.in:
+
+TAGS:
+       etags `find src -type f -name '*.[ch]' -print`