diff options
author | Michael I. Bushnell <mib@gnu.org> | 1995-07-06 19:28:46 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1995-07-06 19:28:46 +0000 |
commit | 0e6dfab61275d138c5572cd61b151984014555bf (patch) | |
tree | cf48c6f5401d7d70d8e53ab559b140f95a94ab0f /Makeconf | |
parent | d5bebe46ab1440e9044c68b30e2921d02a686a0e (diff) |
Added many new rules for automatic dependency generation.
Diffstat (limited to 'Makeconf')
-rw-r--r-- | Makeconf | 65 |
1 files changed, 60 insertions, 5 deletions
@@ -117,15 +117,18 @@ endif ifeq ($(makemode),library) all: $(libname).a $(libname).so -install: $(libname).a $(installhdrs) $(libname).so - ifdef installhdrs - $(INSTALL_DATA) $(installhdrs) $(includedir)/hurd/ - endif +install: $(libdir)/$(libname).a $(libdir)/$(libname).so $(addprefix $(includedir)/hurd/,$(installhdrs)) + +$(libdir)/$(libname).a: $(libname).a $(INSTALL_DATA) $(libname).a $(libdir)/$(libname).a $(RANLIB) $(libdir)/$(libname).a +$(libdir)/$(libname).so: $(libname).so $(INSTALL_DATA) $(libname).so $(libdir)/$(libname).so -endif +$(addprefix $(includedir)/hurd/,$(installhdrs)): $(includedir)/hurd/%: % + $(INSTALL_DATA) $< $@ + +endif # Provide default. install: @@ -263,4 +266,56 @@ $(foreach if,$(hurddefs),$(if)_S.h $(if)Server.c $(if)_U.h $(if)User.c): $(ht) FORCE: + +# How to build automatic dependencies + +# For each file generated by MiG we need a .d file. +# These lines assume that every Makefile that uses a foo_S.h or foo_U.h file +# also mentions the associated fooServer.o or fooUser.o file. +include $(subst Server.o,.migs_d,$(filter %Server.o,$(OBJS))) +include $(subst User.o,.migu_d,$(filter %User.o,$(OBJS))) +include $(subst Server.o,.migsh_d,$(filter %Server.o,$(OBJS))) +include $(subst User.o,.miguh_d,$(filter %User.o,$(OBJS))) + +# For each .o file we need a .d file. +include $(subst .o,.d,$(OBJS)) + + +# Here is how to build those dependency files + +# Dependencies for fooServer.c files. +%.migs_d: %.defs + (set -e; $(CPP) $(CPPFLAGS) $(MIGSFLAGS) $($*-MIGSFLAGS) \ + -DSERVERPREFIX=S_ -M -MG $< | \ + sed -e 's/\.defs\.o:/Server\.c $@:/' > $@) + +# Dependencies for fooUser.c files. +%.migu_d: %.defs + (set -e; $(CPP) $(CPPFLAGS) $(MIGUFLAGS) $($*-MIGUFLAGS) \ + -M -MG $< | \ + sed -e 's/\.defs\.o:/User\.c $@:/' > $@) + +# The associated .h files are build by the same CCP, so a simple massaging +# of the previous two will work. +%.migsh_d: %.migs_d + sed -e 's/Server\.c/_S\.h/' -e 's/migs_d/migsh_d/' < $< > $@ +%.miguh_d: %.migu_d + sed -e 's/User\.c/_U\.h/' -e 's/migu_d/miguh_d/' < $< > $@ + +# Here is how to make .d files from .c files +%.d: %.c + (set -e; $(CC) $(CFLAGS) $(CPPFLAGS) -M -MG $< | \ + sed -e 's/\.o/& $@/' > $@) + +# Here is how to make .d files from .S files +%.d: %.S + (set -e; $(CC) $(CFLAGS) $(CPPFLAGS) -M -MG $< | \ + sed -e 's/\.o/& $@/' > $@) + +# .s files don't go through the preprocessor, so we do this +# This rule must come *after* the genuine ones above, so that +# make doesn't build a .s file and then make an empty dependency +# list. +%.d: %.s + echo '$*.o: $*.s' > $*.d |