1#ident "@(#)r-sunpro.dep	1.20 21/04/28 "
2###########################################################################
3# Written 1996-2019 by J. Schilling
4###########################################################################
5#
6# Dependency building rules for SunPro Make (Schilytools version)
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###########################################################################
23DEP_SUFFIX=	.d
24RMDEP=		$(RM) $(RM_FORCE) $@
25___C++DEP_FILES= $(C++FILES:%.C=%.d)
26__C++DEP_FILES=	$(___C++DEP_FILES:%.cc=%.d)
27_C++DEP_FILES=	$(__C++DEP_FILES:%.cpp=%.d)
28C++DEP_FILES=	$(_C++DEP_FILES:%.cxx=%.d)
29C++PDEP_FILES=	$(C++DEP_FILES:%=$(ARCHDIR)/%)
30DEP_FILE=	$(CFILES:%.c=%.d)		$(C++DEP_FILES)
31PDEP_FILE=	$(CFILES:%.c=$(ARCHDIR)/%.d)	$(C++PDEP_FILES)
32PALLDEP_FILE=	$(CFILES:%.c=$(ARCHDIR)/%.d)	$(C++PDEP_FILES)	$(ARCHDIR)/$(TARGET).dep
33DEP_DEP=	$(ARCHDIR)/Dnull
34###########################################################################
35depend: rmdep $(DEP_FILE)
36
37rmdep:
38	$(RM) $(RM_FORCE) $(PALLDEP_FILE)
39
40###########################################################################
41#
42# Make the complete path to the architecture subdirectory.
43# Make $(ARCHDIR)/man as well here to avoid this directory to become root
44# owned when root later calls "make install".
45#
46###########################################################################
47$(ARCHDIR) $(ARCHDIR)/man:
48		$(MKDIR) -p $@
49
50###########################################################################
51#
52# Generate dependency file(s).
53# This rules is checked when the dependency file(s) are included.
54#
55# Modify the the path for .o files to reflect that they are placed in
56# $(ARCHDIR). Add the dependency file itself to each line so that
57# the dependencies will be rebuilt if a source is newer that the
58# appropriate dependency file.
59#
60###########################################################################
61$(ARCHDIR)/%.d: %.c
62	$(MKDEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKDEP_OUT) $< \
63		| sed -e 's;^\(.*\)\.$o[ 	]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@
64
65$(ARCHDIR)/%.d: %.C
66	$(MKC++DEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKC++DEP_OUT) $< \
67		| sed -e 's;^\(.*\)\.$o[ 	]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@
68$(ARCHDIR)/%.d: %.cc
69	$(MKC++DEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKC++DEP_OUT) $< \
70		| sed -e 's;^\(.*\)\.$o[ 	]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@
71$(ARCHDIR)/%.d: %.cpp
72	$(MKC++DEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKC++DEP_OUT) $< \
73		| sed -e 's;^\(.*\)\.$o[ 	]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@
74$(ARCHDIR)/%.d: %.cxx
75	$(MKC++DEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKC++DEP_OUT) $< \
76		| sed -e 's;^\(.*\)\.$o[ 	]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@
77
78$(PDEP_FILE): $(DEP_DEP)
79
80$(DEP_DEP):
81	$(NOECHO)if [ ! -f $@ ]; then				\
82		echo "	==> MAKING DIRECTORY \"$(ARCHDIR)\"";	\
83		$(_MKDIR) -p $(ARCHDIR);		\
84		echo "	==> MAKING DIRECTORY \"$(ARCHDIR)/man\""; \
85		$(_MKDIR) -p $(ARCHDIR)/man;		\
86		echo > $@;				\
87	else						\
88		: work around v7 shell bug;		\
89	fi
90
91###########################################################################
92#
93# Include the dependency file(s) generated from the rules above.
94#
95###########################################################################
96include	$(PDEP_FILE)
97