blob: 9fc63111ef34733e305f2772e8071204cbcf798b [file] [log] [blame]
paul1b414a12005-04-11 07:05:21 +00001# Solaris packages automake file
paul2e7d9eb2005-04-26 02:35:03 +00002# $Id: Makefile.am,v 1.5 2005/04/26 02:35:03 paul Exp $
paul1b414a12005-04-11 07:05:21 +00003
4.PHONY: packages
5
6# the names of the various subpackages, and some convenient
7# derived variables.
8pkg_names = daemons dev doc libs
9pkg_quagga_daemons = zebra bgpd ospfd ospf6d ripd ripngd
10pkg_name_rev = @PACKAGE_VERSION@-@CONFDATE@-@target_os@-@target_cpu@
11pkg_depends := $(pkg_names:%=depend.%)
12pkg_packages := $(pkg_names:%=@PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg)
13pkg_pkginfos := $(pkg_names:%=pkginfo.%.full)
14pkg_prototypes := $(pkg_names:%=prototype.%)
paul2e7d9eb2005-04-26 02:35:03 +000015pkg_manifests := quagga.xml
paul1b414a12005-04-11 07:05:21 +000016
17# pkgmk variable substitutions wont grok ${variable} in prototype
18# file, so we cant let autoconf generate the file sadly
19# wish automake would just provide a template for this
20edit := $(SED) \
21 -e 's,@prefix\@,$(prefix),g' \
22 -e 's,@exec_prefix,$(exec_prefix),g' \
23 -e 's,@bindir\@,$(bindir),g' \
24 -e 's,@sbindir\@,$(sbindir),g' \
25 -e 's,@libexecdir\@,$(libexecdir),g' \
26 -e 's,@datadir\@,$(datadir),g' \
27 -e 's,@sysconfdir\@,$(sysconfdir),g' \
28 -e 's,@sharedstatedir\@,$(sharedstatedir),g' \
29 -e 's,@localstatedir\@,$(localstatedir),g' \
30 -e 's,@libdir\@,$(libdir),g' \
31 -e 's,@includedir\@,$(includedir),g' \
32 -e 's,@infodir\@,$(infodir),g' \
33 -e 's,@mandir\@,$(mandir),g' \
34 -e 's,@enable_user\@,$(enable_user),g' \
35 -e 's,@enable_group\@,$(enable_group),g' \
36 -e 's,@enable_vty_group\@,$(enable_vty_group),g' \
37 -e 's,@quagga_statedir\@,$(quagga_statedir),g' \
38 -e 's,[@]PACKAGE_NAME[@],@PACKAGE_NAME@,g' \
39 -e 's,[@]PACKAGE_TARNAME[@],@PACKAGE_TARNAME@,g' \
40 -e 's,[@]PACKAGE_VERSION[@],@PACKAGE_VERSION@,g' \
41 -e 's,[@]PACKAGE_BUGREPORT[@],@PACKAGE_BUGREPORT@,g' \
42 -e 's,[@]CONFDATE[@],@CONFDATE@,g' \
43 -e 's,[@]target_cpu[@],$(target_cpu),g' \
44 -e 's,[@]target_host[@],$(target_host),g' \
45 -e 's,[@]target_os[@],$(target_os),g'
46
47# common options for pkgmk
48pkg_make_vars := exec_prefix=@exec_prefix@ prefix=@prefix@ \
49 builddir=@builddir@ srcdir=@srcdir@ \
50 top_builddir=@top_builddir@ top_srcdir=@top_srcdir@ \
51 abs_builddir=@abs_builddir@ abs_srcdir=@abs_srcdir@ \
52 abs_top_builddir=@abs_top_builddir@ abs_top_srcdir=@abs_top_srcdir@
53
54# pkgmk: write the package to spool in build dir, to avoid root dependencies
55pkg_make = pkgmk -o -d @abs_builddir@ \
56 -f $< DESTDIR="$(DESTDIR)/" $(pkg_make_vars)
57
58# pkgtrans: write a pkg file stream, shame we cant pipe directly to it from
59# pkgmk..
60pkg_trans = pkgtrans -s @abs_builddir@ "@abs_builddir@/$@"
61
62# pkgmk can only cope with a single pkginfo, cant 'stack' various
63# pkginfo template files and a package specific pkginfo file in the prototype
64# Create the package specific template here, and create the full pkginfo
65# by cating this and the common pkginfo.tmpl together.
66pkginfo.tmpl: $(srcdir)/pkginfo.tmpl.in Makefile
67 rm -f $@
68 $(edit) $< > $@
69
70pkginfo.%.tmpl: $(srcdir)/pkginfo.%.tmpl.in Makefile
71 rm -f $@
72 $(edit) $< > $@
73
paulf3ff1552005-04-21 10:24:43 +000074pkginfo.%.full: pkginfo.%.tmpl pkginfo.tmpl Makefile
paul1b414a12005-04-11 07:05:21 +000075 cat pkginfo.tmpl pkginfo.$*.tmpl > $@
76
77# use 'edit' above to transform prototype.in to pkgmk acceptable prototype
78prototype.%: $(srcdir)/prototype.%.in Makefile
79 rm -f $@
80 $(edit) $< > $@
81
82# use edit to construct the SMF manifest files
83%.xml: $(srcdir)/%.xml.in Makefile
84 rm -f $@
85 $(edit) $< > $@
86
87# method file (bit like init script)
88quagga.init: $(srcdir)/quagga.init.in Makefile
89 rm -f $@
90 $(edit) $< > $@
91
92# construct the pkg
93@PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg: prototype.% \
pauld98b74b2005-04-13 03:37:23 +000094 quagga.init pkginfo.%.full
paul1b414a12005-04-11 07:05:21 +000095 ($(pkg_make) && \
96 $(pkg_trans) "QUAGGA$*")
97
paul1b414a12005-04-11 07:05:21 +000098%.pkg.gz : %.pkg
99 (gzip -c $< > $@)
100
101# pkginfo.package and prototype.package are all built sources
102#BUILT_SOURCES = pkginfo.daemons pkginfo.dev pkginfo.doc pkginfo.libs \
103# prototype.daemons prototype.dev prototype.doc prototype.libs
104BUILT_SOURCES = $(pkg_pkginfos) pkginfo.tmpl $(pkg_prototypes) \
105 $(pkg_manifests) quagga.init
106
107CLEANFILES := $(BUILT_SOURCES) $(pkg_packages)
108
109EXTRA_DIST := $(pkg_depends) $(pkg_manifests:%=%.in) $(pkg_prototypes:%=%.in) \
110 $(pkg_names:%=pkginfo.%.tmpl.in) $(srcdir)/pkginfo.tmpl.in \
pauld98b74b2005-04-13 03:37:23 +0000111 quagga.init.in README.txt
paul1b414a12005-04-11 07:05:21 +0000112
113pkg-root-install:
114 (cd $(top_builddir) && \
115 $(MAKE) DESTDIR=$(abs_builddir)/quagga-root install)
116
117packages: $(pkg_packages)
118
119#nodist_pkgdata_DATA = $(pkg_packages)