diff options
Diffstat (limited to 'mach')
-rw-r--r-- | mach/Machrules | 53 | ||||
-rw-r--r-- | mach/Makefile | 68 |
2 files changed, 36 insertions, 85 deletions
diff --git a/mach/Machrules b/mach/Machrules index ef5809b..f7f6d2d 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 747a6bf..c4665c2 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 <sys/version.h> as <mach/version.h>. -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 <mach/syscall_sw.h>' | \ + 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 |