1#ident "@(#)rules.tpk	1.8 17/08/04 "
2###########################################################################
3# Written 2005 by J. Schilling
4###########################################################################
5#
6# Rules for creating binary tar packages
7#
8###########################################################################
9# Copyright (c) J. Schilling
10###########################################################################
11# The contents of this file are subject to the terms of the
12# Common Development and Distribution License, Version 1.0 only
13# (the "License").  You may not use this file except in compliance
14# with the License.
15#
16# See the file CDDL.Schily.txt in this distribution for details.
17# A copy of the CDDL is also available via the Internet at
18# http://www.opensource.org/licenses/cddl1.txt
19#
20# When distributing Covered Code, include this CDDL HEADER in each
21# file and include the License file CDDL.Schily.txt from this distribution.
22###########################################################################
23
24###########################################################################
25# If we are included before rules.dir, this will stop to propagate
26# the targets tarpkg1 & tarpkg to sub makes but handle packaging at this
27# directory bundling level.
28###########################################################################
29PKGTARGETS=
30
31OTARSDIR=	$(SRCROOTSL)tars/$(OARCH)
32$(OTARSDIR):
33		$(MKDIR) -p $@
34
35
36_TARGETAR=	$(TARGET_AR:%=$(OTARSDIR)/%)
37__TARGETAR=	$(_UNIQ)$(_TARGETAR)
38___TARGETAR=	$(__TARGETAR:$(_UNIQ)=tarpkg)
39TARGETAR=	$(___TARGETAR:$(_UNIQ)%=%)
40
41_MCS_PROJECT=	$(_UNIQ)$(PROJECTNAME)
42__MCS_PROJECT=	$(_MCS_PROJECT:$(_UNIQ)=SPS-Generic)
43MCS_PROJECTNAME= $(__MCS_PROJECT:$(_UNIQ)%=%)
44
45ta:
46	echo "'$(TARGETAR)'"
47	echo "'$(TARGETAR).tar'"
48
49tarpkg: $(OTARSDIR) tarpkg0 tarpkg1 tarpkg2
50
51tarpkg0:
52	rm -rf tarpkg
53
54tarpkg1:
55	mkdir -p tarpkg tarpkg/$(INSBASE)/bin tarpkg/$(INSBASE)/sbin tarpkg/$(INSBASE)/etc \
56		tarpkg/$(INSBASE)/lib tarpkg/$(INSBASE)/share/man
57	ln -s share/man tarpkg/$(INSBASE)/man
58	if [ ."$(PRE_INST_CMDS)" != . ]; then cd tarpkg && eval "$(PRE_INST_CMDS)" ; fi
59	"$(MAKE)" $(MAKE_FILE) $(MAKEMACS) DESTDIR=`pwd`/tarpkg install
60	if [ ."$(POST_INST_CMDS)" != . ]; then cd tarpkg && eval "$(POST_INST_CMDS)" ; fi
61	-if [ ."$(STRIPLIST)" != . ];  then chmod u+w $(STRIPLIST:%=tarpkg/%); strip $(STRIPLIST:%=tarpkg/%); fi
62	-if [ ."$(STRIPXLIST)" != . ]; then chmod u+w $(STRIPXLIST:%=tarpkg/%); strip -x $(STRIPXLIST:%=tarpkg/%); fi
63	-if [ ."$(MCSLIST)" != . ];    then chmod u+w $(MCSLIST:%=tarpkg/%); mcs -d -a "$(MCS_PROJECTNAME)" $(MCSLIST:%=tarpkg/%); fi
64	if [ ."$(POST_STRIP_CMDS)" != . ]; then cd tarpkg && eval "$(POST_STRIP_CMDS)" ; fi
65	find tarpkg -print | sort > /tmp/so.$$$$; diff filelist /tmp/so.$$$$; rm -f /tmp/so.$$$$
66
67tarpkg2:
68	star -C tarpkg/ pkglist=pkglist -cP > $(TARGETAR).tar
69	bzip2 -9f $(TARGETAR).tar
70	rm -rf tarpkg
71