paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 1 | # Solaris packages automake file |
Paul Jakma | e24f063 | 2006-02-19 18:59:26 +0000 | [diff] [blame] | 2 | # $Id: Makefile.am,v 1.7 2006/02/19 18:59:26 paul Exp $ |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 3 | |
| 4 | .PHONY: packages |
| 5 | |
| 6 | # the names of the various subpackages, and some convenient |
| 7 | # derived variables. |
paul | 65c1caf | 2005-05-13 07:26:07 +0000 | [diff] [blame] | 8 | pkg_names = daemons dev doc libs smf |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 9 | pkg_quagga_daemons = zebra bgpd ospfd ospf6d ripd ripngd |
| 10 | pkg_name_rev = @PACKAGE_VERSION@-@CONFDATE@-@target_os@-@target_cpu@ |
| 11 | pkg_depends := $(pkg_names:%=depend.%) |
| 12 | pkg_packages := $(pkg_names:%=@PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg) |
| 13 | pkg_pkginfos := $(pkg_names:%=pkginfo.%.full) |
| 14 | pkg_prototypes := $(pkg_names:%=prototype.%) |
paul | 2e7d9eb | 2005-04-26 02:35:03 +0000 | [diff] [blame] | 15 | pkg_manifests := quagga.xml |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 16 | |
| 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 |
| 20 | edit := $(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 |
| 48 | pkg_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 |
| 55 | pkg_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.. |
| 60 | pkg_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. |
| 66 | pkginfo.tmpl: $(srcdir)/pkginfo.tmpl.in Makefile |
| 67 | rm -f $@ |
| 68 | $(edit) $< > $@ |
| 69 | |
| 70 | pkginfo.%.tmpl: $(srcdir)/pkginfo.%.tmpl.in Makefile |
| 71 | rm -f $@ |
| 72 | $(edit) $< > $@ |
| 73 | |
paul | f3ff155 | 2005-04-21 10:24:43 +0000 | [diff] [blame] | 74 | pkginfo.%.full: pkginfo.%.tmpl pkginfo.tmpl Makefile |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 75 | cat pkginfo.tmpl pkginfo.$*.tmpl > $@ |
| 76 | |
| 77 | # use 'edit' above to transform prototype.in to pkgmk acceptable prototype |
| 78 | prototype.%: $(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) $< > $@ |
Paul Jakma | e24f063 | 2006-02-19 18:59:26 +0000 | [diff] [blame] | 86 | # use edit to construct the depend files |
| 87 | depend.%: $(srcdir)/depend.%.in Makefile |
| 88 | rm -f $@ |
| 89 | $(edit) $< > $@ |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 90 | |
| 91 | # method file (bit like init script) |
| 92 | quagga.init: $(srcdir)/quagga.init.in Makefile |
| 93 | rm -f $@ |
| 94 | $(edit) $< > $@ |
| 95 | |
| 96 | # construct the pkg |
| 97 | @PACKAGE_TARNAME@-%-$(pkg_name_rev).pkg: prototype.% \ |
paul | d98b74b | 2005-04-13 03:37:23 +0000 | [diff] [blame] | 98 | quagga.init pkginfo.%.full |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 99 | ($(pkg_make) && \ |
| 100 | $(pkg_trans) "QUAGGA$*") |
| 101 | |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 102 | %.pkg.gz : %.pkg |
| 103 | (gzip -c $< > $@) |
| 104 | |
| 105 | # pkginfo.package and prototype.package are all built sources |
| 106 | #BUILT_SOURCES = pkginfo.daemons pkginfo.dev pkginfo.doc pkginfo.libs \ |
| 107 | # prototype.daemons prototype.dev prototype.doc prototype.libs |
| 108 | BUILT_SOURCES = $(pkg_pkginfos) pkginfo.tmpl $(pkg_prototypes) \ |
Paul Jakma | e24f063 | 2006-02-19 18:59:26 +0000 | [diff] [blame] | 109 | $(pkg_manifests) $(pkg_depends) quagga.init |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 110 | |
| 111 | CLEANFILES := $(BUILT_SOURCES) $(pkg_packages) |
| 112 | |
Paul Jakma | e24f063 | 2006-02-19 18:59:26 +0000 | [diff] [blame] | 113 | EXTRA_DIST := $(pkg_manifests:%=%.in) $(pkg_prototypes:%=%.in) \ |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 114 | $(pkg_names:%=pkginfo.%.tmpl.in) $(srcdir)/pkginfo.tmpl.in \ |
Paul Jakma | e24f063 | 2006-02-19 18:59:26 +0000 | [diff] [blame] | 115 | $(pkg_depends:%=%.in) quagga.init.in README.txt |
paul | 1b414a1 | 2005-04-11 07:05:21 +0000 | [diff] [blame] | 116 | |
| 117 | pkg-root-install: |
| 118 | (cd $(top_builddir) && \ |
| 119 | $(MAKE) DESTDIR=$(abs_builddir)/quagga-root install) |
| 120 | |
| 121 | packages: $(pkg_packages) |
| 122 | |
| 123 | #nodist_pkgdata_DATA = $(pkg_packages) |