1#ident @(#)rules.ins	1.32 21/04/28
2###########################################################################
3# Written 1996-2019 by J. Schilling
4###########################################################################
5#
6# Rules for target installation
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$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS):
24			$(INSMKDIR) -p $@
25$(SRCROOT)/bins/$(OARCH):
26			$(MKDIR) -p $@
27
28$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/$(TARGET)$(_EXEEXT):	$(PTARGET)
29			$(INSTALL) $(INSFLAGS) $(INSOPTX) $(PTARGET) $@
30
31#
32# gmake only. Other make implementations use a no-xxx/ prefix.
33# gmake calls prerequisites the the right of | order-only-prerequisites
34# and does not evaluate the time stamp from such prerequisites.
35#
36$(GMAKE_ONLY)$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/$(TARGET)$(_EXEEXT): | \
37					$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)
38
39$(SRCROOT)/bins/$(OARCH)/$(TARGET)$(_EXEEXT):	$(PTARGET)
40			$(INSTALL) $(INSFLAGS) $(INSOPTX) $(PTARGET) $@
41
42PHARDLINKS=	$(HARDLINKS:%=$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/%$(_EXEEXT))
43hardlinks:	finstall $(PHARDLINKS)
44
45PSYMLINKS=	$(SYMLINKS:%=$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/%$(_EXEEXT))
46symlinks:	finstall $(PSYMLINKS)
47
48_INSMODEINS=	$(_UNIQ)$(INSMODEI)
49__INSMODEINS=	$(_INSMODEINS:$(_UNIQ)=$(INSMODEX))
50INSMODEINS=	$(__INSMODEINS:$(_UNIQ)%=%)
51
52dummy $(PHARDLINKS):	$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/$(TARGET)$(_EXEEXT)
53	$(NOECHO)echo "	==> INSTALLING link \"$@\""; $(RM) $(RM_FORCE) $@; [ ! -d "$(@D)" ] && sh $(SRCROOT)/conf/mkdir-sh -p "$(@D)"; $(LN) $(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/$(TARGET)$(_EXEEXT) $@
54
55symdummy $(PSYMLINKS):	$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/$(TARGET)$(_EXEEXT)
56	$(NOECHO)echo "	==> INSTALLING symlink \"$@\""; $(RM) $(RM_FORCE) $@; [ ! -d "$(@D)" ] && sh $(SRCROOT)/conf/mkdir-sh -p "$(@D)"; $(SYMLINK) $(TARGET)$(_EXEEXT) $@
57
58xinstall: finstall
59	$(NOECHO)if [ ".$(XMK_FILE)" != . ] ; then				\
60		for XMK_F in $(XMK_FILE) XxZzY-- ; do			\
61			(						\
62			if [ -r ./$$XMK_F ] ; then				\
63				echo "	==> MAKING \"install\" ON SUBCOMPONENT \"$(CURWDIR)/$$XMK_F\""; \
64				"$(MAKE)" -f $$XMK_F $(MAKEMACS) XARCH=$(XARCH) install;	\
65			else							\
66				if [ $$XMK_F != XxZzY-- ]; then		\
67					echo "NOTICE: Partial source ($(DIRNAME)/$$XMK_F) missing";\
68				fi;					\
69				:;					\
70			fi						\
71			);						\
72		done							\
73	else								\
74		: work around v7 shell bug;				\
75	fi
76
77xuninstall:
78	$(NOECHO)if [ ".$(XMK_FILE)" != . ] ; then				\
79		for XMK_F in $(XMK_FILE) XxZzY-- ; do			\
80			(						\
81			if [ -r ./$$XMK_F ] ; then				\
82				echo "	==> MAKING \"uninstall\" ON SUBCOMPONENT \"$(CURWDIR)/$$XMK_F\""; \
83				"$(MAKE)" -f $$XMK_F $(MAKEMACS) XARCH=$(XARCH) uninstall;	\
84			else							\
85				if [ $$XMK_F != XxZzY-- ]; then		\
86					echo "NOTICE: Partial source ($(DIRNAME)/$$XMK_F) missing";\
87				fi;					\
88				:;					\
89			fi						\
90			);						\
91		done							\
92	else								\
93		: work around v7 shell bug;				\
94	fi
95
96man installman:
97	$(NOECHO)if [ ".$(XMK_FILE)" != . ] ; then				\
98		for XMK_F in $(XMK_FILE) XxZzY-- ; do			\
99			(						\
100			if [ -r ./$$XMK_F ] ; then				\
101				echo "	==> MAKING \"$@\" ON SUBCOMPONENT \"$(CURWDIR)/$$XMK_F\""; \
102				"$(MAKE)" -f $$XMK_F $(MAKEMACS) XARCH=$(XARCH) $@;	\
103			else							\
104				if [ $$XMK_F != XxZzY-- ]; then		\
105					echo "NOTICE: Partial source ($(DIRNAME)/$$XMK_F) missing";\
106				fi;					\
107				:;					\
108			fi						\
109			);						\
110		done							\
111	else								\
112		: work around v7 shell bug;				\
113	fi
114
115finstall:		$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS) \
116			$(WAIT) \
117			$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/$(TARGET)$(_EXEEXT)
118
119install:	all	finstall \
120			hardlinks symlinks \
121			xinstall
122
123uninstall:	xuninstall
124			$(RM) $(RM_FORCE) $(PSYMLINKS) $(PHARDLINKS) \
125			$(DEST_DIR)$(INSBASE)/$(PREINSDIR)$(INSDIR)$(SUBINSDIR)$(SUBINS)/$(TARGET)$(_EXEEXT)
126
127ibins:		all	$(SRCROOT)/bins/$(OARCH) \
128			$(SRCROOT)/bins/$(OARCH)/$(TARGET)$(_EXEEXT)
129