home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / mach / Makefile < prev    next >
Encoding:
Makefile  |  1993-05-19  |  5.2 KB  |  152 lines

  1. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License
  6. # as published by the Free Software Foundation; either version 2 of
  7. # the License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. subdir := mach
  20.  
  21. distribute = Machrules syscalls.awk shortcut.awk
  22.  
  23. headers = mach_init.h mach.h mach-shortcuts.h \
  24.       $(addprefix mach/,$(mach-headers)) \
  25.       # $(interface-headers)
  26. generated = mach-shortcuts.h $(interface-headers)
  27.  
  28. ifndef no_deps    # XXX
  29. mach-headers := host_info.h kern_return.h \
  30.         mach_param.h mach_types.h \
  31.         memory_object.h \
  32.         message.h mig_errors.h msg_type.h \
  33.         policy.h port.h processor_info.h \
  34.         std_types.h task_info.h task_special_ports.h \
  35.         thread_info.h thread_special_ports.h \
  36.         thread_status.h thread_switch.h time_value.h \
  37.         vm_attributes.h vm_inherit.h vm_prot.h \
  38.         vm_statistics.h
  39. endif
  40.  
  41. user-interfaces := $(addprefix mach/,mach_interface mach_port mach_host    \
  42.                      default_pager_object        \
  43.                      memory_object_user            \
  44.                      memory_object_default        \
  45.                      kernel_boot            \
  46.                 )\
  47.            $(addprefix device/,device device_request)
  48. # device_reply is giving me headaches because of userprefix
  49. server-interfaces := # mach/__exc mach/exc
  50.  
  51. routines = $(interface-routines) \
  52.        $(filter-out syscall_%,$(mach-syscalls)) \
  53.        $(addprefix __,$(mach-syscalls)) \
  54.        $(mach-shortcuts) $(addprefix __,$(mach-shortcuts)) \
  55.        mach_init vm_page_size \
  56.        mig_strncpy __msg msg \
  57.        mig_support mig_syms \
  58.        msg_destroy msg_server msg_server_t \
  59.        __msg_dest __msg_server \
  60.        devstream bootprivport # privports
  61.  
  62. tests := hello
  63.  
  64.  
  65. all:
  66.  
  67.  
  68. # Define mach-syscalls and sysno-*.
  69. ifneq ($(no_deps),t)
  70. include $(objpfx)mach-syscalls.mk
  71. endif
  72. $(objpfx)mach-syscalls.mk: mach/syscall_sw.h syscalls.awk
  73. # Go kludges!!!
  74.     sed -n -e '/Unix server implement them/,$$d' \
  75.            -e 's/^kernel_trap(\(.*\),\([-0-9]*\),[0-9]*)$$/\1 \2/p' \
  76.     < $< | awk -f $(word 2,$^) > $@-new              
  77.     mv $@-new $@
  78. generated := $(generated) $(objpfx)mach-syscalls.mk
  79.  
  80. ifdef mach-syscalls
  81. $(mach-syscalls:%=$(objpfx)__%.S): $(objpfx)__%.S: $(objpfx)mach-syscalls.mk
  82.     (echo '#include <sysdep.h>'; \
  83.      echo 'SYSCALL_TRAP (__$*, $(sysno-$*))') > $@-new
  84.      mv $@-new $@
  85. $(mach-syscalls:%=$(objpfx)%.c): $(objpfx)%.c:
  86.     (echo '#include <gnu-stabs.h>'; \
  87.      echo 'symbol_alias (__$*, $*)') > $@-new
  88.     mv $@-new $@
  89. generated := $(generated) \
  90.         $(mach-syscalls:%=$(objpfx)__%.S) \
  91.         $(mach-syscalls:%=$(objpfx)%.c)
  92. endif
  93.  
  94. mach-shortcuts := $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls)))
  95.  
  96. ifndef mach-shortcuts
  97. # Forget about mach_interface.defs for this run.  On the next run,
  98. # $(mach-shortcuts) will be set, and that will change how
  99. # mach_interface.defs is processed: it will get the -D flags below.
  100. user-interfaces := $(filter-out mach/mach_interface \
  101.                 mach/mach_port mach/mach_host,\
  102.                 $(user-interfaces))
  103. endif
  104.  
  105. # Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
  106. migdefines := $(migdefines) \
  107.           $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
  108. mach/mach_interface.uh mach/mach_port.uh: $(objpfx)mach-syscalls.mk
  109.  
  110. ifdef mach-shortcuts
  111. $(mach-shortcuts:%=__%.c): __%.c: shortcut.awk __%_rpc.c
  112.     gawk -v call=__$* -v rpc=__$*_rpc -v syscall=__syscall_$* \
  113.          -f $^ > $@-new
  114.     mv $@-new $@
  115.  
  116. # The shortcut calls have had their names changed to CALL_rpc, so
  117. # CALL_rpc.c is being generated with a symbol alias to __CALL_rpc.  
  118. # We also want CALL.c with an alias to __CALL.
  119. $(mach-shortcuts:%=%.c):
  120.     (echo '#include <gnu-stabs.h>'; \
  121.      echo 'symbol_alias (__$*, $*)') > $@-new
  122.     mv $@-new $@
  123. generated := $(generated) $(mach-shortcuts:%=%.c)
  124.  
  125. # Generate mach-shortcuts.h, which will contain the prototypes for the
  126. # shortcutted kernel RPC functions.
  127. $(objpfx)mach-shortcuts.h: mach/mach_interface.uh mach/mach_port.uh
  128. # The first line gets us one paragraph per line, with @s separating real lines.
  129. # The second line selects paragraphs for the shortcutted functions.
  130. # The third line removes `_rpc' from the names and rerealifies the lines.
  131.     cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
  132.     | grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
  133.     | sed 's/_rpc//' | tr @ \\012 > $@-new
  134.     mv $@-new $@
  135. endif    # mach-shortcuts
  136.  
  137. include Machrules
  138. include ../Rules
  139.  
  140.  
  141. # There is already a mach.h, so mach.defs generates mach_interface.h.
  142. mach/mach_interface.defs: mach/mach.defs
  143.     ln $< $@ || cp $< $@
  144. # There is already a memory_object.h,
  145. # so memory_object.defs generates memory_object_user.h.
  146. mach/memory_object_user.defs: mach/memory_object.defs
  147.     ln $< $@ || cp $< $@
  148. generated := $(generated) mach/mach.defs mach/memory_object_user.defs
  149.  
  150. # Be sure not to make these with implicit rules from foo.defs.
  151. $(filter-out $(interface-headers),$(headers)) : ;
  152.