# # OpenXPKI Deployment Makefile # # Written by Martin Bartosch for the OpenXPKI project 2006 # Copyright (c) 2006 by The OpenXPKI Project # $Revision: 318 $ # VERGEN = ../../tools/vergen BINDIR = [% dir.bindir %] MANDIR = [% dir.mandir %] SYSCONFDIR = [% dir.sysconfdir %] OPENXPKICONFDIR = [% dir.openxpkiconfdir %] DATADIR = [% dir.datadir %] LOCALEDIR = [% dir.localedir %] # FIXME: where will the installpreifx be defined? # FIXME: perhaps something like DESTDIR but inline of some config file? INSTALLPREFIX = [% dir.installprefix %] PERLLIB = [% dir.perllib %] TEMPLATEDIR = [% dir.templatedir %] STATEDIR = [% dir.openxpkistatedir %] SESSIONDIR = [% dir.openxpkisessiondir %] TEMPLATE = default CFG = ./bin/openxpki-metaconf INSTALL = /usr/bin/install RUNUSER = [% server.runuser %] RUNGROUP = [% server.rungroup %] ADMUSER = [% server.admuser %] ADMGROUP = [% server.admgroup %] CONFIGFILE = etc/templates/$(TEMPLATE)/openxpki.conf VERSION_FILE = ./VERSION ########################################################################### # no user serviceable parts below this line TOOLS_SRC = \ bin/openxpkiadm.in \ bin/openxpkictl.in \ bin/openxpki-configure.in \ TOOLS_DST = $(patsubst %.in,%,$(TOOLS_SRC)) TOOLS = $(TOOLS_DST) \ bin/openxpki-metaconf \ all: tools build-man install: makedirs installtemplates installbin postinstallhelp writeversion: @( if [ -e $(VERGEN) ] ; then \ $(VERGEN) --format version > $(VERSION_FILE); \ fi ) @( if [ ! -e $(VERSION_FILE) ] ; then \ echo "Could not determine version" ; \ exit 1; \ fi ) readversion: writeversion VERSION=$(shell cat $(VERSION_FILE)) tools: readversion $(TOOLS) $(TOOLS_DST): $(TOOLS_SRC) $(CONFIGFILE) for file in $(TOOLS_DST) ; do \ $(CFG) \ --config $(CONFIGFILE) \ --setcfg deployment.version="$(VERSION)" \ --file $$file.in >$$file ;\ done build-man: for PROG in $(TOOLS); do pod2man $$PROG $$PROG.1; done makedirs: @echo Creating directories $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(BINDIR) $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(MANDIR)/man1 $(INSTALL) -o $(RUNUSER) -g $(RUNGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(TEMPLATEDIR) $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0755 -d $(DESTDIR)$(INSTALLPREFIX)$(LOCALEDIR) installbin: tools @echo "Installing binary files to $(DESTDIR)$(INSTALLPREFIX)$(BINDIR)" for file in $(TOOLS) ; do \ $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0755 $$file $(DESTDIR)$(INSTALLPREFIX)$(BINDIR)/ ;\ $(INSTALL) -o $(ADMUSER) -g $(ADMGROUP) -m 0644 $$file.1 $(DESTDIR)$(INSTALLPREFIX)$(MANDIR)/man1/ ;\ done installtemplates: @echo "Installing template files to $(DESTDIR)$(INSTALLPREFIX)$(TEMPLATEDIR)" INSTALL=$(INSTALL) \ ADMUSER=$(ADMUSER) \ ADMGROUP=$(ADMGROUP) \ TARGETDIR=$(DESTDIR)$(INSTALLPREFIX)$(TEMPLATEDIR) \ DIREXCLUDE="svn" \ FILEINCLUDE="(\.xml|\.conf|\.txt)$$" \ ./bin/installtemplates.sh clean: rm -f Makefile $(TOOLS_DST) distclean: clean dist: readversion if [ -d openxpki-deployment-$(VERSION) ] ; then \ rm -rf openxpki-deployment-$(VERSION)/ ; \ fi mkdir openxpki-deployment-$(VERSION) tar -c -p -f - \ --exclude "*.svn" \ --exclude "openxpki-deployment-*" \ --exclude "*.1" \ --exclude "*~" \ . | \ tar -C openxpki-deployment-$(VERSION)/ -x -f - find openxpki-deployment-$(VERSION) -name "*.in" | \ sed -e 's/\.in//g' | while read file ; do \ rm -f $$file ; \ done tar cf openxpki-deployment-$(VERSION).tar openxpki-deployment-$(VERSION) gzip --best --force openxpki-deployment-$(VERSION).tar rm -rf openxpki-deployment-$(VERSION)/ help: @echo "OpenXPKI Deployment Tool" @echo @echo "Usage:" @echo "make - build OpenXPKI administrative environment" @echo "make install - install OpenXPKI administrative environment" @echo postinstallhelp: @echo @echo "Installation complete" @echo @echo "You should now run the deployment tool to create a new OpenXPKI instance" @echo "in the default location $(OPENXPKICONFDIR):" @echo @echo "openxpkiadm deploy" @echo summary: @echo "Installation summary:" @echo @echo "Readonly file and directory ownership: $(ADMUSER):$(ADMGROUP)" @echo "OpenXPKI daemon runtime user: $(RUNUSER):$(RUNGROUP)" @echo @echo "Installation directories:" @echo "Bindir: $(BINDIR)" @echo "OpenXPKI config directory: $(OPENXPKICONFDIR)" @echo "OpenXPKI templates: $(TEMPLATEDIR)"