2 # The list of files to install.
4 LOCAL_FILES := clients.conf dictionary templates.conf experimental.conf \
5 proxy.conf radiusd.conf trigger.conf README.rst
7 DEFAULT_SITES := default inner-tunnel
8 LOCAL_SITES := $(addprefix raddb/sites-enabled/,$(DEFAULT_SITES))
10 DEFAULT_MODULES := always attr_filter cache_eap chap \
11 detail detail.log digest dhcp dynamic_clients eap \
12 echo exec expiration expr files linelog logintime \
13 mschap ntlm_auth pap passwd preprocess radutmp realm \
14 replicate soh sradutmp unix utf8
16 LOCAL_MODULES := $(addprefix raddb/mods-enabled/,$(DEFAULT_MODULES))
18 LOCAL_CERT_FILES := Makefile README xpextensions \
19 ca.cnf server.cnf client.cnf bootstrap
21 LOCAL_CERT_PRODUCTS := $(addprefix $(R)$(raddbdir)/certs/,ca.key ca.pem \
22 client.key client.pem server.key server.pem)
24 LEGACY_LINKS := $(addprefix $(R)$(raddbdir)/,users huntgroups hints)
26 RADDB_DIRS := certs mods-available mods-enabled policy.d \
27 sites-available sites-enabled \
28 $(patsubst raddb/%,%,$(shell find raddb/mods-config -type d -print))
30 # Installed directories
31 INSTALL_RADDB_DIRS := $(R)$(raddbdir)/ $(addprefix $(R)$(raddbdir)/, $(RADDB_DIRS))
33 # Grab files from the various subdirectories
34 INSTALL_FILES := $(wildcard raddb/sites-available/* raddb/mods-available/*) \
35 $(LOCAL_SITES) $(LOCAL_MODULES) \
36 $(addprefix raddb/,$(LOCAL_FILES)) \
37 $(addprefix raddb/certs/,$(LOCAL_CERT_FILES)) \
38 $(shell find raddb/mods-config -type f -print) \
39 $(shell find raddb/policy.d -type f -print)
41 # Re-write local files to installed files, filtering out editor backups
42 INSTALL_RADDB := $(patsubst raddb/%,$(R)$(raddbdir)/%,\
43 $(filter-out %~,$(INSTALL_FILES)))
47 build.raddb: $(LOCAL_SITES) $(LOCAL_MODULES)
51 install: install.raddb
54 raddb/sites-enabled raddb/mods-enabled:
56 @$(INSTALL) -d -m 750 $@
58 # Set up the default modules for running in-source builds
59 raddb/mods-enabled/%: raddb/mods-available/% | raddb/mods-enabled
61 @cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)
63 # Set up the default sites for running in-source builds
64 raddb/sites-enabled/%: raddb/sites-available/% | raddb/sites-enabled
66 @cd $(dir $@) && ln -sf ../sites-available/$(notdir $@)
68 # Installation rules for directories. Note permissions are 750!
69 $(INSTALL_RADDB_DIRS):
70 @echo INSTALL $(patsubst $(R)$(raddbdir)%,raddb%,$@)
71 @$(INSTALL) -d -m 750 $@
73 # The installed files have ORDER dependencies. This means that they
74 # will be installed if the target doesn't exist. And they won't be
75 # installed if the target already exists, even if it is out of date.
77 # This dependency lets us install the server on top of an existing
78 # system, hopefully without breaking anything.
80 ifeq "$(wildcard $(R)$(raddbdir)/mods-available/)" ""
81 # Installation rules for mods-enabled. Note ORDER dependencies
82 $(R)$(raddbdir)/mods-enabled/%: | $(R)$(raddbdir)/mods-available/%
83 @cd $(dir $@) && ln -sf ../mods-available/$(notdir $@)
85 # Installation rules for sites-enabled. Note ORDER dependencies
86 $(R)$(raddbdir)/sites-enabled/%: | $(R)$(raddbdir)/sites-available/%
87 @cd $(dir $@) && ln -sf ../sites-available/$(notdir $@)
90 # Installation rules for plain modules.
91 $(R)$(raddbdir)/%: | raddb/%
92 @echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
93 @$(INSTALL) -m 640 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@
95 # Create symbolic links for legacy files
96 $(R)$(raddbdir)/huntgroups: $(R)$(modconfdir)/preprocess/huntgroups
97 @[ -e $@ ] || echo LN-S $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
98 @[ -e $@ ] || ln -s $(patsubst $(R)$(raddbdir)/%,./%,$<) $@
100 $(R)$(raddbdir)/hints: $(R)$(modconfdir)/preprocess/hints
101 @[ -e $@ ] || echo LN-S $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
102 @[ -e $@ ] || ln -s $(patsubst $(R)$(raddbdir)/%,./%,$<) $@
104 $(R)$(raddbdir)/users: $(R)$(modconfdir)/files/authorize
105 @[ -e $@ ] || echo LN-S $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
106 @[ -e $@ ] || ln -s $(patsubst $(R)$(raddbdir)/%,./%,$<) $@
108 $(LOCAL_CERT_PRODUCTS):
109 @echo BOOTSTRAP raddb/certs/
110 @$(MAKE) -C $(R)$(raddbdir)/certs/
112 # Bootstrap is special
113 $(R)$(raddbdir)/certs/bootstrap: | raddb/certs/bootstrap $(LOCAL_CERT_PRODUCTS)
114 @echo INSTALL $(patsubst $(R)$(raddbdir)/%,raddb/%,$@)
115 @$(INSTALL) -m 750 $(patsubst $(R)$(raddbdir)/%,raddb/%,$@) $@
117 # List directories before the file targets.
118 # It's not clear why GNU Make doesn't deal well with this.
119 install.raddb: | $(INSTALL_RADDB_DIRS) $(INSTALL_RADDB) $(LEGACY_LINKS)
122 @rm -f *~ $(addprefix raddb/sites-enabled/,$(DEFAULT_SITES)) \
123 $(addprefix raddb/mods-enabled/,$(DEFAULT_MODULES))
126 # A handy target to find out which triggers are where.
127 # Should only be run by SNMP developers.
130 @grep exec_trigger `find src -name "*.c" -print` | grep '"' | sed -e 's/.*,//' -e 's/ *"//' -e 's/");.*//'