aboutsummaryrefslogtreecommitdiff
path: root/rcynic/Makefile.in
blob: 1e15f5bf939879bc82c1ba5f1797712e82e15361 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# $Id$

NAME = rcynic

BIN = ${NAME}
SRC = ${NAME}.c
OBJ = ${NAME}.o

GEN = defstack.h

OBJS = ${OBJ} bio_f_linebreak.o

CFLAGS = @CFLAGS@ -Wall -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror-implicit-function-declaration
LDFLAGS = @LDFLAGS@ @LD_STATIC_FLAG@
LIBS = @LIBS@

AWK			= @AWK@
SORT			= @SORT@
PYTHON			= @PYTHON@
RRDTOOL			= @RRDTOOL@
INSTALL			= @INSTALL@
SU			= @SU@
SUDO			= @SUDO@
CHROOT			= @CHROOT@
CHROOTUID		= @CHROOTUID@

abs_top_srcdir		= @abs_top_srcdir@
abs_top_builddir	= @abs_top_builddir@

prefix			= @prefix@
exec_prefix		= @exec_prefix@
datarootdir		= @datarootdir@
datadir			= @datadir@
localstatedir		= @localstatedir@
sharedstatedir		= @sharedstatedir@
sysconfdir		= @sysconfdir@
bindir			= @bindir@
sbindir			= @sbindir@
libexecdir		= @libexecdir@
sysconfdir		= @sysconfdir@

abs_builddir		= @abs_builddir@
abs_top_srcdir		= @abs_top_srcdir@
abs_top_builddir	= @abs_top_builddir@
srcdir			= @srcdir@

RCYNIC_INSTALL_TARGETS	= @RCYNIC_INSTALL_TARGETS@
RCYNIC_DIR		= @RCYNIC_DIR@
RCYNIC_JAIL_DIRS	= @RCYNIC_JAIL_DIRS@
RCYNIC_CONF_FILE	= @RCYNIC_CONF_FILE@
RCYNIC_TA_DIR		= @RCYNIC_TA_DIR@
RCYNIC_BIN_RCYNIC	= @RCYNIC_BIN_RCYNIC@
RCYNIC_DATA_DIR		= ${RCYNIC_DIR}/data
RCYNIC_RPKI_RTR_DIR	= ${RCYNIC_DIR}/rpki-rtr
RCYNIC_DIRS		= ${RCYNIC_TA_DIR} ${RCYNIC_JAIL_DIRS} ${RCYNIC_DATA_DIR} ${RCYNIC_RPKI_RTR_DIR}
RCYNIC_CONF_RSYNC	= @RCYNIC_CONF_RSYNC@
RCYNIC_CONF_DATA	= @RCYNIC_CONF_DATA@
RCYNIC_CONF_TA_DIR	= @RCYNIC_CONF_TA_DIR@
RCYNIC_USER		= rcynic
RCYNIC_GROUP		= rcynic
RCYNIC_GECOS		= RPKI Validation System
RCYNIC_STATIC_RSYNC	= @RCYNIC_STATIC_RSYNC@
RCYNIC_HTML_DIR		= @RCYNIC_HTML_DIR@

SCRIPTS = rcynic-text rcynic-html rcynic-svn validation_status rcynic-cron

all: ${BIN} ${SCRIPTS} ${RCYNIC_STATIC_RSYNC}

clean:
	if test -r static-rsync/Makefile; then cd static-rsync; ${MAKE} $@; fi
	rm -f ${BIN} ${OBJS} ${SCRIPTS}

${OBJ}: ${SRC} ${GEN}

${BIN}: ${OBJS}
	${CC} ${CFLAGS} -o $@ ${OBJS} ${LDFLAGS} ${LIBS}

${GEN}: ${SRC}
	${PYTHON} ${abs_top_srcdir}/buildtools/defstack.py ${SRC} >$@.tmp
	mv $@.tmp $@

COMPILE_PYTHON = \
	AC_PYTHON_INTERPRETER='${PYTHON}' \
	AC_RRDTOOL_BINARY='${RRDTOOL}' \
	${PYTHON} ${abs_top_srcdir}/buildtools/make-rcynic-script.py <$? >$@; \
	chmod 755 $@

COMPILE_PYTHON_CRON = \
	AC_PYTHON_INTERPRETER='${PYTHON}' \
	AC_RCYNIC_USER='${RCYNIC_USER}' \
	AC_RCYNIC_GROUP='${RCYNIC_GROUP}' \
	AC_RCYNIC_DIR='${RCYNIC_DIR}' \
	AC_bindir='${bindir}' \
	AC_sysconfdir='${sysconfdir}' \
	AC_RCYNIC_HTML_DIR='${RCYNIC_HTML_DIR}' \
	AC_SU='${SU}' \
	AC_SUDO='${SUDO}' \
	AC_CHROOT='${CHROOT}' \
	AC_CHROOTUID='${CHROOTUID}' \
	${PYTHON} ${abs_top_srcdir}/buildtools/make-rcynic-script.py <$? >$@; \
	chmod 755 $@

rcynic-text: rcynic-text.py
	${COMPILE_PYTHON}

rcynic-html: rcynic-html.py
	${COMPILE_PYTHON}

rcynic-svn: rcynic-svn.py
	${COMPILE_PYTHON}

validation_status: validation_status.py
	${COMPILE_PYTHON}

rcynic-cron: rcynic-cron.py
	${COMPILE_PYTHON_CRON}

tags: TAGS

TAGS: ${SRC} ${GEN}
	etags ${SRC} ${GEN}

test: ${BIN}
	if test -r rcynic.conf; \
	then \
		./${BIN} -j 0 && \
		test -r rcynic.xml && \
		echo && \
		./rcynic-text rcynic.xml; \
	else \
		 echo No rcynic.conf, skipping test; \
	fi

uninstall deinstall:
	@echo Sorry, automated deinstallation of rcynic is not implemented yet

distclean: clean
	if test -r static-rsync/Makefile; then cd static-rsync; ${MAKE} $@; fi
	rm -f Makefile

static-rsync/rsync:
	@echo "Building static rsync for use in chroot jail"
	cd static-rsync; ${MAKE} all

install: ${BIN} ${RSYNC_INSTALL_TARGETS}

# From here down is a long list of rules to handle installation on
# various platforms.  This used to be a set of nasty shell scripts,
# now it's nasty Makefile autoconf AC_SUBST_FILE snippets.
#
# Still working out details here.

create-rcynic-directories: ${RCYNIC_DIRS}

${RCYNIC_DIRS}:
	mkdir -p -v -555 $@

postconf-rcynic-directories: ${RCYNIC_DATA_DIR} ${RCYNIC_RPKI_RTR_DIR}
	chown ${RCYNIC_USER}:${RCYNIC_GROUP} ${RCYNIC_DATA_DIR} ${RCYNIC_RPKI_RTR_DIR}

# Old script only installed trust anchors if rcynic.conf was missing.
# Haven't decided yet whether we want to preserve that behavior.

install-rcynic-trust-anchors: ${RCYNIC_TA_DIR}
	@cd sample-trust-anchors; \
	for i in *.tal; \
	do \
	    ${INSTALL} -C -p -m 444 "$$i" "${RCYNIC_TA_DIR}/$$i"; \
	done

install-rcynic-conf: ${RCYNIC_CONF_FILE}

${RCYNIC_CONF_FILE}:
	@echo Found no ${RCYNIC_CONF_FILE}, creating sample config.  You might want to edit this.
	@echo > $@.tmp '# Sample rcynic configuration file.  See documentation for details.'
	@echo >>$@.tmp ''
	@echo >>$@.tmp '[rcynic]'
	@echo >>$@.tmp 'rsync-program		= ${RCYNIC_CONF_RSYNC}'
	@echo >>$@.tmp 'authenticated		= ${RCYNIC_CONF_DATA}/authenticated'
	@echo >>$@.tmp 'unauthenticated		= ${RCYNIC_CONF_DATA}/unauthenticated'
	@echo >>$@.tmp 'lockfile		= ${RCYNIC_CONF_DATA}/lock'
	@echo >>$@.tmp 'xml-summary		= ${RCYNIC_CONF_DATA}/rcynic.xml'
	@echo >>$@.tmp 'jitter			= 600'
	@echo >>$@.tmp 'use-syslog		= true'
	@echo >>$@.tmp 'log-level		= log_usage_err'
	@cd ${RCYNIC_TA_DIR}; \
	 j=1; \
	 for i in *.tal; \
	 do \
	    echo >>$@ "trust-anchor-locator.$$j	= ${RCYNIC_CONF_TA_DIR}/$$i"; \
	    j=$$((j+1)); \
         done
	@chmod 444 $@.tmp
	@mv $@.tmp $@

install-rcynic: ${RCYNIC_BIN_RCYNIC}

${RCYNIC_BIN_RCYNIC}: ${BIN}
	${INSTALL} -p -m 555 ${BIN} $@

install-static-rsync: ${RCYNIC_DIR}/bin/rsync

${RCYNIC_DIR}/bin/rsync: static-rsync/rsync
	${INSTALL} -p -m 555 static-rsync/rsync $@

install-scripts: ${bindir}/rcynic-text ${bindir}/rcynic-html ${bindir}/rcynic-svn ${bindir}/validation_status

${bindir}/rcynic-text: rcynic-text
	${INSTALL} -p -m 555 rcynic-text ${bindir}

${bindir}/rcynic-html: rcynic-html
	${INSTALL} -p -m 555 rcynic-html ${bindir}

${bindir}/rcynic-svn: rcynic-svn
	${INSTALL} -p -m 555 rcynic-svn ${bindir}

${bindir}/validation_status: validation_status
	${INSTALL} -p -m 555 validation_status ${bindir}

.FORCE:

# Not sure we want this, test it both ways I guess
#.PHONY: .FORCE

@RCYNIC_MAKE_RULES@