2 # The list of files to install.
4 LOCAL_FILES := acct_users clients.conf dictionary templates.conf \
5 experimental.conf hints huntgroups \
6 preproxy_users proxy.conf radiusd.conf trigger.conf \
9 DEFAULT_SITES := default inner-tunnel
10 LOCAL_SITES := $(addprefix raddb/sites-enabled/,$(DEFAULT_SITES))
12 DEFAULT_MODULES := always attr_filter attr_rewrite cache_eap chap checkval \
13 counter cui detail detail.log digest dhcp dynamic_clients eap \
14 echo exec expiration expr files inner-eap linelog logintime \
15 mschap ntlm_auth pap passwd preprocess radutmp realm \
16 replicate soh sradutmp unix utf8 wimax
18 LOCAL_MODULES := $(addprefix raddb/mods-enabled/,$(DEFAULT_MODULES))
20 LOCAL_CERT_FILES := Makefile bootstrap README xpextensions \
21 ca.cnf server.cnf client.cnf
23 RADDB_DIRS := sites-available sites-enabled mods-available mods-enabled \
26 # Installed directories
27 INSTALL_RADDB_DIRS := $(R)$(raddbdir)/ $(addprefix $(R)$(raddbdir)/, \
28 $(RADDB_DIRS) $(shell find raddb/sql -type d -print))
30 # Grab files from the various subdirectories
31 INSTALL_FILES := $(wildcard raddb/sites-available/* raddb/mods-available/*) \
32 $(LOCAL_SITES) $(LOCAL_MODULES) \
33 $(addprefix raddb/,$(LOCAL_FILES)) \
34 $(addprefix raddb/certs/,$(LOCAL_CERT_FILES)) \
35 $(wildcard raddb/policy.d/* raddb/filter/*) \
36 $(shell find raddb/sql -type f -print)
39 # Re-write local files to installed files, filtering out editor backups
40 INSTALL_RADDB := $(patsubst raddb/%,$(R)$(raddbdir)/%,\
41 $(filter-out %~,$(INSTALL_FILES)))
45 build.raddb: $(LOCAL_SITES) $(LOCAL_MODULES)
49 install: install.raddb
52 raddb/sites-enabled raddb/mods-enabled:
56 # Set up the default modules for running in-source builds
57 raddb/mods-enabled/%: raddb/mods-available/% | raddb/mods-enabled
59 @cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)
61 # Set up the default sites for running in-source builds
62 raddb/sites-enabled/%: raddb/sites-available/% | raddb/sites-enabled
64 @cd $(dir $@) && ln -sf ../sites-available/$(notdir $@)
66 # Installation rules for directories. Note permissions are 750!
67 $(INSTALL_RADDB_DIRS):
68 @echo INSTALL $(patsubst $(R)$(raddbdir)%,raddb%,$@)
69 @$(INSTALL) -d -m 750 $@
71 # The installed files have ORDER dependencies. This means that they
72 # will be installed if the target doesn't exist. And they won't be
73 # installed if the target already exists, even if it is out of date.
75 # This dependency lets us install the server on top of an existing
76 # system, hopefully without breaking anything.
78 # Installation rules for mods-enabled. Note ORDER dependencies
79 $(R)$(raddbdir)/mods-enabled/%: | $(R)$(raddbdir)/mods-available/%
80 @cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)
82 # Installation rules for sites-enabled. Note ORDER dependencies
83 $(R)$(raddbdir)/sites-enabled/%: | $(R)$(raddbdir)/sites-available/%
84 @cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)
86 # Installation rules for plain modules.
87 $(R)$(raddbdir)/%: | raddb/%
88 @echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
89 @$(INSTALL) -m 640 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@
91 # Bootstrap is special
92 $(R)$(raddbdir)/certs/bootstrap: | raddb/certs/bootstrap
93 @echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
94 @$(INSTALL) -m 750 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@
96 # List directories before the file targets.
97 # It's not clear why GNU Make doesn't deal well with this.
98 install.raddb: $(INSTALL_RADDB_DIRS) $(INSTALL_RADDB)
101 @rm -f *~ $(addprefix raddb/sites-enabled/,$(DEFAULT_SITES)) \
102 $(addprefix raddb/mods-enabled/,$(DEFAULT_MODULES))
105 # A handy target to find out which triggers are where.
106 # Should only be run by SNMP developers.
109 @grep exec_trigger `find src -name "*.c" -print` | grep '"' | sed -e 's/.*,//' -e 's/ *"//' -e 's/");.*//'