Web inteface: nicer system error page, and introduced a bug (OK, a photo of a bug :-)
[openxpki.git] / trunk / deployment / Makefile.in
blobab0304d01b83d29c9aa41919318b94fe053f00a3
2 # OpenXPKI Deployment Makefile
4 # Written by Martin Bartosch for the OpenXPKI project 2006
5 # Copyright (c) 2006 by The OpenXPKI Project
8 VERGEN = ../../tools/vergen
10 SHELL = [% shell.bash %]
11 BINDIR = [% dir.bindir %]
12 MANDIR = [% dir.mandir %]
13 SYSCONFDIR = [% dir.sysconfdir %]
14 OPENXPKICONFDIR = [% dir.openxpkiconfdir %]
15 DATADIR = [% dir.datadir %]
16 LOCALEDIR = [% dir.localedir %]
17 # FIXME: where will the installpreifx be defined?
18 # FIXME: perhaps something like DESTDIR but inline of some config file?
19 INSTALLPREFIX = [% dir.installprefix %]
20 PERLLIB = [% dir.perllib %]
21 TEMPLATEDIR = [% dir.templatedir %]
22 STATEDIR = [% dir.openxpkistatedir %]
23 SESSIONDIR = [% dir.openxpkisessiondir %]
25 TEMPLATE = default
27 CFG = ./bin/openxpki-metaconf
28 INSTALL = /usr/bin/install
30 RUNUSER = [% server.runuser %]
31 RUNGROUP = [% server.rungroup %]
32 ADMUSER = [% server.admuser %]
33 ADMGROUP = [% server.admgroup %]
35 CONFIGFILE = etc/templates/$(TEMPLATE)/openxpki.conf
36 VERSION_FILE = ./VERSION
38 ###########################################################################
39 # no user serviceable parts below this line
41 TOOLS_SRC = \
42 bin/openxpkiadm.in \
43 bin/openxpkictl.in \
44 bin/openxpki-configure.in \
46 TOOLS_DST = $(TOOLS_SRC:.in=)
48 TOOLS = $(TOOLS_DST) \
49 bin/openxpki-metaconf \
51 TOOLS_MAN1 = $(TOOLS_SRC:.in=.1) \
52 bin/openxpki-metaconf.1 \
54 all: tools build-man
56 install: makedirs installtemplates installbin postinstallhelp
58 writeversion:
59 @( if [ -e $(VERGEN) ] ; then \
60 $(VERGEN) --format version > $(VERSION_FILE); \
61 fi )
62 @( if [ ! -e $(VERSION_FILE) ] ; then \
63 echo "Could not determine version" ; \
64 exit 1; \
65 fi )
67 readversion: writeversion
68 VERSION=$(shell cat $(VERSION_FILE))
70 tools: readversion $(TOOLS)
72 $(TOOLS_DST): $(TOOLS_SRC) $(CONFIGFILE)
73 for file in $(TOOLS_DST) ; do \
74 $(CFG) \
75 --config $(CONFIGFILE) \
76 --setcfg deployment.version="$(VERSION)" \
77 --file $$file.in >$$file ;\
78 done
80 build-man:
81 for PROG in $(TOOLS); do pod2man $$PROG $$PROG.1; done
83 makedirs:
84 @echo Creating directories
85 @if (test `uname` = "SunOS"); then \
86 /usr/sbin/install -u $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(BINDIR); \
87 /usr/sbin/install -u $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(MANDIR)/man1; \
88 /usr/sbin/install -u $(RUNUSER) -g $(RUNGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(TEMPLATEDIR); \
89 /usr/sbin/install -u $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(LOCALEDIR); \
90 else \
91 $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(BINDIR); \
92 $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(MANDIR)/man1; \
93 $(INSTALL) -o $(RUNUSER) -g $(RUNGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(TEMPLATEDIR); \
94 $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(LOCALEDIR); \
95 fi
97 installbin: tools
98 @echo "Installing binary files to $(DESTDIR)$(INSTALLPREFIX)$(BINDIR)"
99 @for file in $(TOOLS) ; do \
100 if (test `uname` = "SunOS"); then \
101 /usr/sbin/install -u $(ADMUSER) -g $(ADMGROUP) -m 0755 -f $(DESTDIR)$(INSTALLPREFIX)$(BINDIR)/ $$file ;\
102 /usr/sbin/install -u $(ADMUSER) -g $(ADMGROUP) -m 0644 -f $(DESTDIR)$(INSTALLPREFIX)$(MANDIR)/man1/ $$file.1 ;\
103 else \
104 $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0755 $$file $(DESTDIR)$(INSTALLPREFIX)$(BINDIR)/ ;\
105 $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0644 $$file.1 $(DESTDIR)$(INSTALLPREFIX)$(MANDIR)/man1/ ;\
106 fi; \
107 done
109 installtemplates:
110 @echo "Installing template files to $(DESTDIR)$(INSTALLPREFIX)$(TEMPLATEDIR)"
111 INSTALL=$(INSTALL) \
112 ADMUSER=$(ADMUSER) \
113 ADMGROUP=$(ADMGROUP) \
114 TARGETDIR=$(DESTDIR)$(INSTALLPREFIX)$(TEMPLATEDIR) \
115 DIREXCLUDE="svn" \
116 FILEINCLUDE="(\.xml|\.conf|\.txt)$$" \
117 ./bin/installtemplates.sh
119 #FIXME: quickstart/openxpki.conf file, created by the "configure", is not removed by the next target
120 clean:
121 rm -f Makefile $(TOOLS_DST) $(TOOLS_MAN1) $(CONFIGFILE)
123 distclean: clean
125 dist: readversion
126 if [ -d openxpki-deployment-$(VERSION) ] ; then \
127 rm -rf openxpki-deployment-$(VERSION)/ ; \
129 mkdir openxpki-deployment-$(VERSION)
130 tar -c -p -f - \
131 --exclude "*.svn" \
132 --exclude "Makefile" \
133 --exclude "openxpki-deployment-*" \
134 --exclude "*.1" \
135 --exclude "*~" \
136 . | \
137 tar -C openxpki-deployment-$(VERSION)/ -x -f -
138 find openxpki-deployment-$(VERSION) -name "*.in" | \
139 sed -e 's/\.in//g' | while read file ; do \
140 rm -f $$file ; \
141 done
142 tar cf openxpki-deployment-$(VERSION).tar openxpki-deployment-$(VERSION)
143 gzip --best --force openxpki-deployment-$(VERSION).tar
144 rm -rf openxpki-deployment-$(VERSION)/
147 help:
148 @echo "OpenXPKI Deployment Tool"
149 @echo
150 @echo "Usage:"
151 @echo "make - build OpenXPKI administrative environment"
152 @echo "make install - install OpenXPKI administrative environment"
153 @echo
155 postinstallhelp:
156 @echo
157 @echo "Installation complete"
158 @echo
159 @echo "You should now run the deployment tool to create a new OpenXPKI instance"
160 @echo "in the default location $(OPENXPKICONFDIR):"
161 @echo
162 @echo "openxpkiadm deploy"
163 @echo
165 summary:
166 @echo "Installation summary:"
167 @echo
168 @echo "Readonly file and directory ownership: $(ADMUSER):$(ADMGROUP)"
169 @echo "OpenXPKI daemon runtime user: $(RUNUSER):$(RUNGROUP)"
170 @echo
171 @echo "Installation directories:"
172 @echo "Bindir: $(BINDIR)"
173 @echo "OpenXPKI config directory: $(OPENXPKICONFDIR)"
174 @echo "OpenXPKI templates: $(TEMPLATEDIR)"