about summary refs log tree commit diff
path: root/mach
diff options
context:
space:
mode:
Diffstat (limited to 'mach')
-rw-r--r--mach/Machrules17
-rw-r--r--mach/Makefile3
2 files changed, 15 insertions, 5 deletions
diff --git a/mach/Machrules b/mach/Machrules
index bc0ee3783b..cd2545b784 100644
--- a/mach/Machrules
+++ b/mach/Machrules
@@ -100,10 +100,17 @@ echo "weak_alias (__$$call, $$call)" >> $(objpfx)tmp_$${call}.c;
 endef
 endif
 
+
+# Generate `#include <NAME.defs>', taking $* for NAME.
+# If $(NAME.defs) is defined use its value in place of `NAME.defs'.
+define include-%.defs
+echo '#include <$(firstword $($*.defs) $*.defs)>'
+endef
+
 # Not an implicit rule so the stamps are never removed as intermediates!
 $(patsubst %,$(objpfx)%.ustamp,$(user-interfaces)): $(objpfx)%.ustamp:
 	rm -f $@
-	echo '#include <$*.defs>' | \
+	$(include-%.defs) | \
 	$(MIG) - /dev/null -prefix __ \
 	       $(MIGFLAGS) $(user-MIGFLAGS) $(MIGFLAGS-$*) \
 	       -i $(objpfx)tmp_ \
@@ -118,7 +125,7 @@ $(patsubst %,$(objpfx)%.ustamp,$(user-interfaces)): $(objpfx)%.ustamp:
 $(patsubst %,$(objpfx)%.udeps,$(user-interfaces)):
   $(objpfx)%.udeps: $(..)mach/Machrules
 	$(make-target-directory)
-	echo '#include <$*.defs>' | \
+	$(include-%.defs) | \
 	$(CC) $(CPPFLAGS) -M -x c - | \
 	sed -e 's,- *:,$@ $(@:.udeps=.ustamp) $(@:.udeps=.uh) $(@:.udeps=.__h)\
 			  $(@:.udeps=_server.c) $(@:.udeps=_server.h):,' \
@@ -130,7 +137,7 @@ vpath %_server.c $(addprefix $(objpfx),$(sort $(dir $(server-interfaces))))
 
 # Build the server stubs in $(objdir).
 $(objpfx)%_server.c $(objpfx)%_server.h:
-	echo '#include <$*.defs>' | \
+	$(include-%.defs) | \
 	$(MIG) - /dev/null -prefix _S_ \
 	       $(MIGFLAGS) $(server-MIGFLAGS) $(MIGFLAGS-$*) \
 	       $< -user /dev/null -header /dev/null \
@@ -141,14 +148,14 @@ $(objpfx)%_server.c $(objpfx)%_server.h:
 $(objpfx)%.uh:; $(mig.uh)
 define mig.uh
 $(make-target-directory)
-echo '#include <$*.defs>' | \
+$(include-%.defs) | \
 $(MIG) - /dev/null $(MIGFLAGS) \
        -header $@ -server /dev/null -user /dev/null
 endef
 $(objpfx)%.__h:; $(mig.__h)
 define mig.__h
 $(make-target-directory)
-echo '#include <$*.defs>' | \
+$(include-%.defs) | \
 $(MIG) - /dev/null $(MIGFLAGS) -prefix __ \
        -header $@ -server /dev/null -user /dev/null
 endef
diff --git a/mach/Makefile b/mach/Makefile
index c4665c204c..bf3816485d 100644
--- a/mach/Makefile
+++ b/mach/Makefile
@@ -45,6 +45,9 @@ user-interfaces := $(addprefix mach/,mach_interface mach_port mach_host	\
 				     default_pager default_pager_helper	\
 	            )\
 		   $(addprefix device/,device device_request)
+# We produce mach_interface.h from mach.defs because there is already a
+# <mach/mach.h> that is not the interface header (thanks CMU).
+mach_interface.defs = mach.defs
 server-interfaces := mach/exc
 tests := hello
 # It is important that we do not use the wildcard function to expand