1#ident "@(#)r-smake.dep 2.4 21/04/28 " 2########################################################################### 3# Written 1996-2019 by J. Schilling 4########################################################################### 5# 6# Dependency building rules for smake 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 62# Do not define Simple Suffix Rules anymore 63#.d: .c 64# $(MKDEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKDEP_OUT) $< \ 65# | sed -e 's;^\(.*\)\.$o[ ]*:;\1.$o \1.d:;' > $(ARCHDIR)/$@ 66 67$(ARCHDIR)/%.d: %.c 68 $(MKDEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKDEP_OUT) $< \ 69 | sed -e 's;^\(.*\)\.$o[ ]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@ 70 71$(ARCHDIR)/%.d: %.C 72 $(MKC++DEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKC++DEP_OUT) $< \ 73 | sed -e 's;^\(.*\)\.$o[ ]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@ 74$(ARCHDIR)/%.d: %.cc 75 $(MKC++DEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKC++DEP_OUT) $< \ 76 | sed -e 's;^\(.*\)\.$o[ ]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@ 77$(ARCHDIR)/%.d: %.cpp 78 $(MKC++DEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKC++DEP_OUT) $< \ 79 | sed -e 's;^\(.*\)\.$o[ ]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@ 80$(ARCHDIR)/%.d: %.cxx 81 $(MKC++DEP) $(CPP_FLAGS) $(CPPFLAGS) $(MKC++DEP_OUT) $< \ 82 | sed -e 's;^\(.*\)\.$o[ ]*:;$(ARCHDIR)/\1.$o $(ARCHDIR)/\1.d:;' > $@ 83 84$(PDEP_FILE): $(DEP_DEP) 85 86$(DEP_DEP): 87 $(NOECHO)if [ ! -f $@ ]; then \ 88 echo " ==> MAKING DIRECTORY \"$(ARCHDIR)\""; \ 89 $(_MKDIR) -p $(ARCHDIR); \ 90 echo " ==> MAKING DIRECTORY \"$(ARCHDIR)/man\""; \ 91 $(_MKDIR) -p $(ARCHDIR)/man; \ 92 echo > $@; \ 93 else \ 94 : work around v7 shell bug; \ 95 fi 96 97#$(DEP_FILE): 98# $(MKDEP) $(CPP_FLAGS) $(CPPFLAGS) -f - $(CFILES) \ 99# | sed -e 's;^\(.*\.$o[ ]*:\);$(ARCHDIR)/\1;' > $@ 100 101########################################################################### 102# 103# Include the dependency file(s) generated from the rules above. 104# 105########################################################################### 106include $(PDEP_FILE) 107