From aa1075ea2f140dc7b2eec04199935b47111229db Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 12 May 1996 16:38:08 +0000 Subject: Sun May 12 11:16:58 1996 Roland McGrath * mach/Machrules (%.udeps rule): Write deps for %_server.[ch] too. (%_server.[ch] rule): Don't depend on %.defs; use #include to get installed .defs file. * stdio-common/vfprintf.c (flockfile, funlockfile): Define to nothing for stdio. Fix fUNlockfile -> funlockfile for libio. * stdio-common/vfscanf.c: Likewise. Sat May 11 13:43:41 1996 Roland McGrath * hurd/hurdfault.c: Include faultexc_server.h instead of faultexc.h. * mach/Machrules (%.ir rule): Don't produce deps for imports. * elf/dl-fini.c (_dl_fini): Clear L->l_init_called after calling fn. * Makerules (install): Depend on $(slibdir)/libc.so$(libc.so-version). [!subdir] ($(libdir)/libc.so, $(common-objpfx)/libc-syms.so): Protect these targets and install dep on $(libdir)/libc.so with this. * hurd/Makefile: Removed all rules and defns for using code from Hurd sources and installing headers from there. * sysdeps/mach/hurd/errnos.awk: Set in_mach_errors to FILENAME when we set it. In Mach error matching clause, only match if FILENAME is still the same value. * sysdeps/mach/hurd/Makefile: Don't include sysdeps/mach/Makefile; $(mach-srcdir) no longer exists. (hurd-srcdir): Variable removed. (includes): Don't append -I$(hurd-srcdir). (last-includes): Variable removed. Remove vpath specs using $(hurd-srcdir). (mach-errno-h): New canned sequence. ($(common-objpfx)errnos.d): New target, generated included makefile to determine absolute file names of Mach headers to search for error codes and set variable mach-errnos-deps. ($(common-objpfx)stamp-errnos): Depend on $(mach-errnos-deps) instead of prior explicit list. (generated): Add errnos.d, stamp-errnos. * mach/Machrules (some-if-rtn): New variable and target; compute deps of some if routine and make all if routines depend on that .d file instead of static list of .h files. * mach/Makefile (mach/mach_interface.defs, mach/memory_object_user.defs): Targets removed. ($(objpfx)mach-syscalls.mk): Tweak this kludge so it doesn't depend directly on Mach sources. * sysdeps/mach/Makefile (mach-srcdir): Variable removed. (includes): Don't append -I$(mach-srcdir). Remove vpath specs using $(mach-srcdir). * hurd/Makefile (server-interfaces): Add faultexc. (sig): Remove it from here. (fault%.[ch]): Rule removed. (MIGFLAGS-faultexc): New variable. * hurd/faultexc.defs: New file. * mach/Machrules (%.ustamp rule): Pass $(MIGFLAGS-$*) to mig. (%_server.[ch] rule): Likewise. * mach/Makefile: Removed all rules and defns for using code from Mach sources and installing headers from there. * Makeconfig [$(build-shared)=yes] (link-libc): Append $(libc.so-version) to libc.so. * mach/Machrules (%.ustamp rule): Don't depend on %.defs. (%.udeps): New rule parallel to that one, generating included makefiles with -M output from `#include <%.defs>'. * Makerules (sed-remove-objpfx): Remove space before \ at eol. --- mach/Machrules | 53 ++++++++++++++++++++++++--------------------- mach/Makefile | 68 +++++++--------------------------------------------------- 2 files changed, 36 insertions(+), 85 deletions(-) (limited to 'mach') diff --git a/mach/Machrules b/mach/Machrules index ef5809b86c..f7f6d2df63 100644 --- a/mach/Machrules +++ b/mach/Machrules @@ -81,19 +81,14 @@ endif # other useful pattern) causes the rule for `host_info' to also match # `xxx_host_info', and analogous lossage. # -# While we're at it, we figure out the imports used by %.defs and give them -# as dependencies of the object files for the generated RPC_*.c files. -# # Depend on %.h just so they will be built from %.uh in the # makefile-rebuilding run which builds %.ir; otherwise, %.uh is built as an # intermediate in order to make %.ir and then removed before re-exec, when # %.uh is built all over again to build %.h. $(objpfx)%.ir: $(objpfx)%.uh $(objpfx)%.h (awk "NF == 4 && (\$$2 == \"Routine\" || \$$2 == \"SimpleRoutine\")\ - { printf \"$*-calls += %s\\n\", \$$3 } \ - /^#include/ { printf \"$*-imports += %s\\n\", \$$2 }" $< ;\ + { printf \"$*-calls += %s\\n\", \$$3 }" $< ;\ echo '$$($*-calls:%=$$(objpfx)R\%C_%.c): $$(objpfx)$*.ustamp ;';\ - echo '$$($*-calls:%=$$(objpfx)RPC_%.o): $$($*-imports:<%>=%)' ;\ ) > $@-new mv $@-new $@ vpath Machrules ../mach # Find ourselves. @@ -106,9 +101,12 @@ endef endif # Not an implicit rule so the stamps are never removed as intermediates! -$(patsubst %,$(objpfx)%.ustamp,$(user-interfaces)): $(objpfx)%.ustamp: %.defs - $(MIG) $< $(MIGFLAGS) $(user-MIGFLAGS) \ - -prefix __ -i $(objpfx)tmp_ \ +$(patsubst %,$(objpfx)%.ustamp,$(user-interfaces)): $(objpfx)%.ustamp: + rm -f $@ + echo '#include <$*.defs>' | \ + $(MIG) - /dev/null -prefix __ \ + $(MIGFLAGS) $(user-MIGFLAGS) $(MIGFLAGS-$*) \ + -i $(objpfx)tmp_ \ -server /dev/null -user /dev/null -header /dev/null for call in $($*-calls); do \ $(transform-user-stub) \ @@ -116,15 +114,24 @@ $(patsubst %,$(objpfx)%.ustamp,$(user-interfaces)): $(objpfx)%.ustamp: %.defs $(objpfx)RPC_$${call}.c; \ done touch $@ +-include $(patsubst %,$(objpfx)%.udeps,$(user-interfaces)) +$(patsubst %,$(objpfx)%.udeps,$(user-interfaces)): $(objpfx)%.udeps: + echo '#include <$*.defs>' | \ + $(CC) $(CPPFLAGS) -M -x c - | \ + sed -e 's,- *:,$@ $(@:.udeps=.ustamp) \ + $(@:.udeps=_server.c) $(@:.udeps=_server.h):,' \ + $(sed-remove-objpfx) > $@.new + mv -f $@.new $@ # Look for the server stub files where they will be written. vpath %_server.c $(addprefix $(objpfx),$(sort $(dir $(server-interfaces)))) # Build the server stubs in $(objdir). -$(objpfx)%_server.c $(objpfx)%_server.h: %.defs - $(MIG) $< $(MIGFLAGS) $(server-MIGFLAGS) \ - -prefix _S_ \ - -user /dev/null -header /dev/null \ +$(objpfx)%_server.c $(objpfx)%_server.h: + echo '#include <$*.defs>' | \ + $(MIG) - /dev/null -prefix _S_ \ + $(MIGFLAGS) $(server-MIGFLAGS) $(MIGFLAGS-$*) \ + $< -user /dev/null -header /dev/null \ -server $(@:.h=.c) -sheader $(@:.c=.h) # To get header files that declare both the straight and __ functions, @@ -176,18 +183,14 @@ interface-headers: $(interface-headers) # dependencies ahead of time anyway because they're boilerplate. omit-deps += $(interface-routines) -# Specify the static dependencies of the generated files. -$(foreach o,$(object-suffixes),\ -$(foreach if,$(user-interfaces),$($(if)-calls:%=$(objpfx)RPC_%$o))): \ - mach/boolean.h mach/kern_return.h mach/message.h mach/notify.h \ - mach/mach_types.h mach/mig_errors.h mach/mig_support.h mach/msg_type.h \ - $(..)libc-symbols.h $(objpfx)config.h -$(foreach o,$(object-suffixes),\ -$(server-interfaces:%=$(objpfx)%$o)): \ - mach/boolean.h mach/kern_return.h mach/message.h mach/mig_errors.h \ - mach/mig_support.h mach/std_types.h -# The MiG-generated sources also depend on the imports in their .defs files. -# These dependencies are generated into the .ir files above. +# Choose any single module generated by MiG. We will compute this module's +# dependencies and then assume all other MiG-generated modules depend on the +# same headers. +some-if-rtn := $(firstword $(interface-routines)) +ifdef some-if-rtn +$(foreach o,$(object-suffixes),$(interfaces-routines:%=%$o)): $(some-if-rtn).d +generated += $(some-if-rtn).d +endif # If defined, $(interface-library) is `libNAME'. It is to be a library # containing all the MiG-generated functions for the specified interfaces. diff --git a/mach/Makefile b/mach/Makefile index 747a6bfead..c4665c204c 100644 --- a/mach/Makefile +++ b/mach/Makefile @@ -57,57 +57,21 @@ distribute += Machrules syscalls.awk shortcut.awk \ # Clear any environment value. generated = -# Get the proper definition of `mach-srcdir'. -include ../sysdeps/mach/Makefile - -# Use and install the Mach header files directly out of the Mach kernel source. - -# Find the MiG defs files in the kernel source. -vpath %.defs $(mach-srcdir) - -# Install all .h and .defs files we find in some of the kernel's source -# directories and their subdirectories (in MK82, max one level deep). -mach-src-headers := $(wildcard $(foreach dir,mach device mach_debug \ - $(base-machine),\ - $(addprefix $(mach-srcdir)/$(dir)/,\ - *.defs *.h \ - */*.defs */*.h))) -# Exclude mach/machine/*. A symlink will be installed for mach/machine. -# Exclude $(headers) for Mach files we have our own versions of. -mach-headers = $(filter-out mach/machine/% $(headers),\ - $(mach-src-headers:$(mach-srcdir)/%=%)) -# Rename Mach's sys/version.h to mach/version.h. -mach-headers := $(patsubst sys/version.h,mach/version.h,$(mach-headers)) - -# Don't distribute the Mach headers; they are in the Mach distribution. -dont_distribute = $(mach-headers) - -# DO NOT try to remake these in any way!!! -$(addprefix $(mach-srcdir)/,$(mach-headers)) : ; -install-others += $(addprefix $(includedir)/,$(mach-headers)) -$(includedir)/%: $(mach-srcdir)/%; $(do-install) - -# Make symlinks for machine and mach/machine in the include directory. -install-others += $(includedir)/mach/machine $(includedir)/machine -$(includedir)/mach/machine $(includedir)/machine: $(common-objpfx)config.make - -rm -f $@ - cd $(@D); ln -s $(base-machine) $(@F) - -# Install Mach's as . -install-others += $(includedir)/mach/version.h -$(includedir)/mach/version.h: $(mach-srcdir)/sys/version.h; $(do-install) - # Define mach-syscalls and sysno-*. ifndef no_deps ifndef inhibit_mach_syscalls include $(objpfx)mach-syscalls.mk endif endif -$(objpfx)mach-syscalls.mk: mach/syscall_sw.h syscalls.awk +$(objpfx)mach-syscalls.mk: syscalls.awk Makefile # Go kludges!!! - sed -n -e '/Unix server implement them/,$$d' \ - -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\ - < $< | awk -f $(word 2,$^) > $@-new + echo '#include ' | \ + DEPENDENCIES_OUTPUT='$@-dep $@' \ + $(CC) $(CPPFLAGS) -E -x c-header - \ + -D_MACH_`echo $(base-machine) | tr a-z A-Z`_SYSCALL_SW_H_=1 | \ + sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\ + | awk -f $< > $@-new + cat $@-dep >> $@-new; rm -f $@-dep mv $@-new $@ generated += mach-syscalls.mk @@ -170,22 +134,6 @@ include Machrules include ../Rules -# There is already a mach.h, so mach.defs generates mach_interface.h. -$(objpfx)mach/mach_interface.defs: $(mach-srcdir)/mach/mach.defs - ln $< $@ || cp $< $@ -# There is already a memory_object.h, -# so memory_object.defs generates memory_object_user.h. -$(objpfx)mach/memory_object_user.defs: $(mach-srcdir)/mach/memory_object.defs - ln $< $@ || cp $< $@ - -ifdef objdir -vpath mach/mach_interface.defs $(objdir) -vpath mach/memory_object_user.defs $(objdir) -endif - -# Be sure not to make these with implicit rules from foo.defs. -mach.h mach/memory_object.h: ; - # A gcc bug prevents the generated file from working properly, # so we have one in the distribution for the time being. generated += errsystems.c -- cgit v1.2.3