GNUmakefile.in 3.83 KB
Newer Older
1
#
2
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
22
23
24
25
26
27
28
29
30
31
32
33
#

SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= ..
SUBDIR		= named

ETCDIR          = /etc
NAMEDB_DIR	= $(ETCDIR)/namedb
OURDOMAIN       = @OURDOMAIN@

# This is silly. Needs to be done properly.
34
35
TESTBED_NETWORK          = @TESTBED_NETWORK@
EXTERNAL_TESTBED_NETWORK = @EXTERNAL_TESTBED_NETWORK@
36
37
IPV6_ENABLED             = @IPV6_ENABLED@
IPV6_SUBNET_PREFIX       = @IPV6_SUBNET_PREFIX@
Leigh B Stoller's avatar
Leigh B Stoller committed
38
DISABLE_NAMED_INSTALL    = @DISABLE_NAMED_INSTALL@
39
40
41
42
43
44

REVERSE_MAPNAME          = \
		$(shell echo @TESTBED_NETWORK@ | sed -e 's,.0$$,,')
EXTERNAL_REVERSE_MAPNAME = \
		$(shell echo @EXTERNAL_TESTBED_NETWORK@ | sed -e 's,.0$$,,')

45
46
REVFILES                 = $(REVERSE_MAPNAME).db.head
ifneq ($(REVERSE_MAPNAME), $(EXTERNAL_REVERSE_MAPNAME))
47
REVFILES                += $(EXTERNAL_REVERSE_MAPNAME).db.head
48
endif
49
50
51
52
53
ifeq ($(IPV6_ENABLED),1)
IPV6_MAPNAME             = \
		$(shell echo @IPV6_SUBNET_PREFIX@ | sed -e 's,\:,\.,g')
REVFILES                += $(IPV6_MAPNAME).db.head
endif
54

55
56
BOSSTOKEN       = $(shell echo @BOSSNODE@ | sed -e 's/\..*//')
USERTOKEN       = $(shell echo @USERNODE@ | sed -e 's/\..*//')
57

58
59
NAMED_FILES	= named.conf.template named_makeconf named_makerev \
		 reverse.head \
60
		 resolv.conf localhost.rev forward.head named_makeforw \
61
62
		 $(REVFILES) $(OURDOMAIN).db.head\
		 $(OURDOMAIN).internal.db.head \
63
		 named.conf resolv.conf.ops mail.access
64
65
66
67
68
69
70
71

include $(OBJDIR)/Makeconf

#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
# 
all: $(NAMED_FILES)
72
	echo $(REVFILES)
73
74
75

include $(TESTBED_SRCDIR)/GNUmakerules

76
77
$(OURDOMAIN).db.head: forward.head named_makeforw
	perl named_makeforw -external forward.head > $@
78

79
80
$(OURDOMAIN).internal.db.head: forward.head named_makeforw
	perl named_makeforw -internal forward.head > $@
81
82
83
84

named.conf:	named.conf.template named_makeconf
	perl named_makeconf named.conf.template > named.conf

85
86
87
mail.access: mail_makeaccess
	perl mail_makeaccess > mail.access

88
89
90
$(REVFILES):	reverse.head named_makerev
	perl named_makerev reverse.head

91
92
# This is not a safe install target after initial install!
install:
93
94
	@echo "Are you sure you want to reinstall the namedb files!"
	@echo "Use the install-real target if you are sure"
95

Leigh B Stoller's avatar
Leigh B Stoller committed
96
97
98
99
100
101
102
103
104
105
ifeq ($(DISABLE_NAMED_INSTALL),0)
install-real:	install-real-force
else
install-real:	
	@echo "Refusing to install cause DISABLE_NAMED_INSTALL=1";
	@echo "Use the install-real-force target if you are sure"
endif

install-real-force: \
		resolv.conf \
106
		$(NAMEDB_DIR)/named.conf \
107
108
		$(NAMEDB_DIR)/localhost.rev \
		$(NAMEDB_DIR)/$(OURDOMAIN).db.head \
109
		$(NAMEDB_DIR)/$(OURDOMAIN).internal.db.head \
110
		$(addprefix $(NAMEDB_DIR)/reverse/, $(wildcard *.db.head))
111
	$(INSTALL_DATA) resolv.conf $(ETCDIR)/resolv.conf
112

113
114
115
install-reverse: \
		$(addprefix $(NAMEDB_DIR)/reverse/, $(wildcard *.db.head))

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
clean: 
	rm -f $(NAMED_FILES)

$(ETCDIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(ETCDIR)
	$(INSTALL) $< $@

$(NAMEDB_DIR)/%: %
	@echo "Installing $<"
	-mkdir -p $(NAMEDB_DIR)
	$(INSTALL) $< $@

$(NAMEDB_DIR)/reverse/%: %
	@echo "Installing $<"
	-mkdir -p $(NAMEDB_DIR)/reverse
	$(INSTALL) $< $@