1#ident "@(#)r-smake.dep	1.8 02/10/11 "
2###########################################################################
3# Written 1996 by J. Schilling
4###########################################################################
5#
6# Dependency building rules for smake
7#
8###########################################################################
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2, or (at your option)
12# any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; see the file COPYING.  If not, write to
21# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22###########################################################################
23DEP_SUFFIX=	.d
24RMDEP=		$(RM) $(RM_FORCE) $(ARCHDIR)/$@
25DEP_FILE=	$(CFILES:%.c=%.d)
26PDEP_FILE=	$(CFILES:%.c=$(ARCHDIR)/%.d)
27PALLDEP_FILE=	$(CFILES:%.c=$(ARCHDIR)/%.d) $(ARCHDIR)/$(TARGET).dep
28###########################################################################
29depend: rmdep $(DEP_FILE)
30
31rmdep:
32	$(RM) $(RM_FORCE) $(PALLDEP_FILE)
33
34###########################################################################
35#
36# Make the complete path to the architecture subdirectory.
37#
38###########################################################################
39$(ARCHDIR):
40		$(MKDIR) -p $@
41
42###########################################################################
43#
44# Generate dependency file(s).
45# This rules is checked when the dependency file(s) are included.
46#
47# Modify the the path for .o files to reflect that they are placed in
48# $(ARCHDIR). Add the dependency file itself to each line so that
49# the dependencies will be rebuilt if a source is newer that the
50# appropriate dependency file.
51#
52###########################################################################
53.d:	.c
54	$(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $< \
55		| sed -e 's;^\(.*\)\.o[ 	]*:;\1.o \1.d:;' > $(ARCHDIR)/$@
56
57%.d: %.c
58	$(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $< \
59		| sed -e 's;^\(.*\)\.o[ 	]*:;\1.o \1.d:;' > $(ARCHDIR)/$@
60
61Dnull: $(ARCHDIR)
62	@echo > $O/$@
63
64#$(DEP_FILE):
65#		$(MKDEP) $(CPPFLAGS) -f - $(CFILES) \
66#			| sed -e 's;^\(.*\.o[ 	]*:\);$(ARCHDIR)/\1;' > $@
67
68###########################################################################
69#
70# Include the dependency file(s) generated from the rules above.
71#
72###########################################################################
73include		Dnull $(DEP_FILE)
74