home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / conf / template.mk < prev    next >
Encoding:
Makefile  |  1992-07-09  |  9.8 KB  |  374 lines

  1. #
  2. # Mach Operating System
  3. # Copyright (c) 1992,1991 Carnegie Mellon University
  4. # All Rights Reserved.
  5. # Permission to use, copy, modify and distribute this software and its
  6. # documentation is hereby granted, provided that both the copyright
  7. # notice and this permission notice appear in all copies of the
  8. # software, derivative works or modified versions, and any portions
  9. # thereof, and that both notices appear in supporting documentation.
  10. #
  11. # CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  12. # CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  13. # ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  14. #
  15. # Carnegie Mellon requests users of this software to return to
  16. #
  17. #  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  18. #  School of Computer Science
  19. #  Carnegie Mellon University
  20. #  Pittsburgh PA 15213-3890
  21. #
  22. # any improvements or extensions that they make and grant Carnegie Mellon
  23. # the rights to redistribute these changes.
  24. #
  25. #
  26. # HISTORY
  27. # $Log:    template.mk,v $
  28. # Revision 2.3  92/07/08  16:16:55  mrt
  29. #     Dropped the -MD from MIGFLAGS. If it is appropriate, it will be
  30. #     defined in osf.mach3.mk
  31. #     [92/07/06            mrt]
  32. #     Changed the SOBJS rule to use all the CCFLAGS except the
  33. #     optimization level as gcc-cpp won't accept them.
  34. #     [92/07/02            mrt]
  35. # Revision 2.2  92/06/25  17:28:23  mrt
  36. #     New Server makefile template for new Reno style make.
  37. #     This file used to be named Makefile.template. Much
  38. #     of the reformating was done by Glenn Marcy of the
  39. #     Open Software Foundation.
  40. #     [92/04/28            mrt]
  41. #     $EndLog$
  42. #
  43. #
  44.  
  45.  
  46. # ${EXPORTBASE}/bsdss/machine has copies of the ${KERN_MACHINE_DIR} files
  47. # All the directories in which md generated relative dependencies must be
  48. # on VPATH
  49. VPATH=..:${EXPORTBASE}/bsdss${INCDIRS:S/-I/:/g}
  50. OTHERS=${LOAD}
  51.  
  52. DEPENDENCIES=
  53. MIG_HDRS = 
  54.  
  55. DEFINES        = -DCOMPAT_43 -DBSD=44 -DMACH_IPC_COMPAT=0 $(VOLATILE)
  56. ALLOPTS        = ${IDENT} -DKERNEL ${DEFINES}
  57. LINTOPTS    = ${ALLOPTS}
  58.  
  59. CFLAGS        = ${ALLOPTS} ${PROFILING:D-DGPROF}
  60. DRIVER_CFLAGS    =${CFLAGS}
  61. PROFILING_CFLAGS=${CFLAGS}
  62. CC_OPT_LEVEL    =-g
  63.  
  64. #INCFLAGS are procesed by genpath and expanded relative to all the 
  65. # sourcedirs, _CC_GENINC is not. _CC_GENINC is also the additional list
  66. # of directories that are seached for th #include "foo.h" files.
  67. INCFLAGS    =-I.. -I${EXPORTBASE}/bsdss 
  68. #INCDIRS    = -I${EXPORTBASE}/usr/include (set in setvar.csh)
  69. _CC_GENINC_    = -I. 
  70.  
  71. LIBS        = -lthreads -lmach_sa
  72. #CRT0        = ${EXPORTBASE}/usr/lib/crt0.o
  73. CRT0        != wh -q -L crt0.o
  74. #LIBDIRS    = -L${EXPORTBASE}/usr/lib (set in setvar.csh)
  75.  
  76. MIGFLAGS    = ${IDENT} ${DEFINES}
  77.  
  78. #
  79. #  LDOBJS is the set of object files which comprise the server.
  80. #  It is used both in the dependency list for each *vmunix.swap
  81. #  rule emitted by config and also in the .sys.swap rule
  82. #  below which links the kernel from these objects.
  83. #  
  84. #  LDOBJS_PREFIX and LDOBJS_SUFFIX are defined in the machine
  85. #  dependent Makefile (if necessary).
  86. #
  87. LDOBJS=${LDOBJS_PREFIX} ${OBJS} ${LDOBJS_SUFFIX}
  88.  
  89. #
  90. #  LDDEPS is the set of extra dependencies associated with each
  91. #  *vmunix.swap rule (in addition to $LDOBJS and the swap*.o file).
  92. #
  93. #  LDDEPS_PREFIX is defined in the machine dependent Makefile
  94. #  (if necessary).
  95. #
  96.  
  97. LDDEPS=${LDDEPS_PREFIX} conf/newvers.sh conf/copyright \
  98.     conf/version.major conf/version.minor conf/version.variant \
  99.     conf/version.edit conf/version.patch symbols.sort
  100.  
  101. #
  102. #  PRELDDEPS is another set of extra dependencies associated with each
  103. #  *vmunix.swap rule (in addition to $LDOBJS and the swap*.o file).
  104. #  It is defined in the machine dependent Makefile (if necessary).
  105. #
  106. #  The generated rule looks like
  107. #    vmunix.sys : ${PRELDDEPS} ${LDOBJS} ${LDDEPS}
  108. #
  109.  
  110. #
  111. #  SWAPDEPS is the set of extra dependencies associated with each
  112. #  swap*.o rule emitted by config (in addition to the
  113. #  ../machine/swap*.c file).
  114. #
  115. #  SWAPDEPS_PREFIX is defined in the machine dependent Makefile
  116. #  (if necessary).
  117. #
  118. SWAPDEPS=${SWAPDEPS_PREFIX} 
  119.  
  120. #
  121. #  SYSDEPS is the set of extra dependencies associated with each
  122. #  *vmunix rule (in addition to *vmunix.sys).
  123. #
  124. #  SYSDEPS_PREFIX is defined in the machine dependent Makefile
  125. #  (if necessary).
  126. #
  127. SYSDEPS=${SYSDEPS_PREFIX}
  128.  
  129.  
  130. #
  131. #  These macros are filled in by the config program depending on the
  132. #  current configuration.  The MACHDEP macro is replaced by the
  133. #  contents of the machine dependent makefile template and the others
  134. #  are replaced by the corresponding symbol definitions for the
  135. #  configuration.
  136. #
  137.  
  138. %OBJS
  139.  
  140. %CFILES
  141.  
  142. %SFILES
  143.  
  144. %BFILES
  145.  
  146. %ORDERED
  147.  
  148. %MACHDEP
  149.  
  150.  
  151. #
  152. #  This macro is replaced by definitions for the name ${LOAD} and 
  153. #  ${LOAD}.swap. It also generates the dependency for ${LOAD}.swap
  154. #
  155.  
  156. %LOAD
  157.  
  158. .include <${RULES_MK}>
  159.  
  160.  
  161. .SUFFIXES: .swap .sys
  162.  
  163. .PRECIOUS: Makefile
  164.  
  165. #
  166. #  Default rule used to build a *vmunix.sys configuration from the
  167. #  object list and a particular *vmunix.swap module.  The *vmunix.swap
  168. #  module is a normal object file compiled from the appropriate swap*.c
  169. #  file and then copied to the *vmunix.swap name to trigger the full
  170. #  kernel link using this default rule.
  171. #
  172.  
  173. .swap.sys:
  174.     /bin/sh ${conf/newvers.sh:P} \
  175.         `cat vers.config` \
  176.         ${conf/copyright:P} \
  177.         `cat ${conf/version.major:P} \
  178.              ${conf/version.minor:P} \
  179.              ${conf/version.variant:P} \
  180.              ${conf/version.edit:P} \
  181.              ${conf/version.patch:P}`
  182.     ${_CC_} -c ${_CCFLAGS_} vers.c
  183.     rm -f ${.TARGET:.sys=} ${.TARGET}
  184.     @echo loading ${.TARGET}
  185.     ${_LD_} ${_LDFLAGS_} ${LDOBJS} vers.o ${.PREFIX}.swap \
  186.          ${CRT0} ${_LIBS_}
  187.     @echo stripping ${.TARGET}
  188.     -xstrip a.out
  189.     -size a.out
  190.     chmod 755 a.out
  191.     -mv a.out ${.TARGET}
  192.  
  193. relink: ${LOAD:=.relink}
  194.  
  195. ${LOAD:=.relink}: ${LDDEPS}
  196.     /bin/sh ${conf/newvers.sh:P} \
  197.         ${conf/copyright:P} \
  198.         `cat ${conf/version.major:P} \
  199.              ${conf/version.minor:P} \
  200.              ${conf/version.variant:P} \
  201.              ${conf/version.edit:P} \
  202.              ${conf/version.patch:P}`
  203.     ${_CC_} -c ${_CCFLAGS_} vers.c
  204.     rm -f ${.TARGET:.relink=} ${.TARGET:.relink=.sys}
  205.     @echo loading ${.TARGET:.relink=.sys}
  206.     ${_LD_} ${_LDFLAGS_} ${LDOBJS} vers.o \
  207.         ${.PREFIX}.swap ${CRT0} ${_LIBS_}
  208.     chmod 755 a.out
  209.     -${SWAPSYS}
  210.     -mv a.out ${.TARGET:.relink=.sys}
  211.     eval `awk 'NR==1{S=$$1;next;};\
  212.      END {\
  213.        C = "ln ${.TARGET:.relink=.sys} ${.TARGET:.relink=}";\
  214.        if (S != "") {\
  215.          C = C "; ln ${.TARGET:.relink=} ${.TARGET:.relink=}" S; \
  216.          printf "rm -f ${.TARGET:.relink=}%s; ", S; \
  217.        }\
  218.        printf "echo \"%s\"; %s\n", C, C; \
  219.      }' vers.suffix`
  220.  
  221. ${LOAD}: $${.TARGET:=.sys} ${SYSDEPS}
  222.     eval `awk 'NR==1{S=$$1;next;}\
  223.     END {\
  224.       C = "ln ${.TARGET}.sys ${.TARGET}";\
  225.       if (S != "") {\
  226.         C = C "; ln ${.TARGET} ${.TARGET}" S; \
  227.         printf "rm -f ${.TARGET}%s; ", S; \
  228.       }\
  229.       printf "echo \"%s\"; %s\n", C, C; \
  230.     }' vers.suffix`
  231.  
  232. ${LOAD:=.sys}: ${PRELDDEPS} ${LDOBJS} ${LDDEPS}
  233.  
  234. ${LOAD:=.swap}: $${$${.TARGET}_SWAPSPEC}
  235.     @${CP} ${${.TARGET}_SWAPSPEC} ${.TARGET}
  236.  
  237. ${LOAD:@.F.@${${.F.}_SWAPSPEC}@}: ${SWAPDEPS}
  238.  
  239.  
  240. #
  241. #  OBJSDEPS is the set of files (defined in the machine dependent
  242. #  template if necessary) which all objects depend on (such as an
  243. #  in-line assembler expansion filter
  244. #
  245.  
  246. ${OBJS}: ${OBJSDEPS}
  247.  
  248.  
  249. .if !defined(MACHINEDEP_RULES)
  250. ${COBJS}: $${$${.TARGET}_SOURCE}
  251.     ${_CC_} -c ${_CCFLAGS_} ${${${.TARGET}_SOURCE}:P}
  252.  
  253. #  Leave out the optimzation flags as gcc-cpp doesn't like  them
  254.  
  255. _CPPFLAGS_=\
  256.     ${_CC_CFLAGS_}\
  257.     ${${.TARGET}_CENV:U${CENV}}\
  258.     ${${.TARGET}_CFLAGS:U${CFLAGS}} ${TARGET_FLAGS}\
  259.     ${${.TARGET}_CARGS:U${CARGS}}\
  260.     ${_CC_NOSTDINC_} ${_GENINC_} ${_CC_INCDIRS_} ${_CC_PICLIB_}
  261.  
  262. ${SOBJS}: $${$${.TARGET}_SOURCE}
  263.     ${ASCPP} ${_CPPFLAGS_} ${${${.TARGET}_SOURCE}:P} > ${.PREFIX}.i 
  264.     ${AS} ${ASFLAGS} -o ${.TARGET} ${.PREFIX}.i 
  265.     ${RM} ${_RMFLAGS_} ${.PREFIX}.i
  266. .endif
  267.  
  268. ${DECODE_OFILES}: $${$${.TARGET}_SOURCE}
  269.     ${RM} ${_RMFLAGS_} ${.TARGET}
  270.     ${UUDECODE} ${${${.TARGET}_SOURCE}:P}
  271.  
  272. #
  273. #  Rules for components which are not part of the kernel proper or that
  274. #  need to be built in a special manner.
  275. #
  276.  
  277. MKODIRS = uxkern
  278.  
  279. #  The Mig-generated files go into subdirectories.
  280. #  This target makes sure they exist
  281.  
  282. .BEGIN : 
  283.     @-for dir in ${MKODIRS}; do \
  284.     [ -d $$dir ] || \
  285.       { echo "mkdir $$dir"; mkdir $$dir; } \
  286.     done
  287.  
  288.  
  289. #
  290. #  Mach IPC-based interfaces
  291. #
  292.  
  293. #  Explicit dependencies on generated files,
  294. #  to ensure that Mig has been run by the time
  295. #  these files are compiled.
  296.  
  297. bsd_server.o: uxkern/bsd_1_server.c uxkern/bsd_types_gen.h 
  298.  
  299.  
  300. bsd_server_side.o: uxkern/bsd_types_gen.h
  301.  
  302.  
  303. BSD_1_FILES = uxkern/bsd_1_server.c
  304.  
  305. $(BSD_1_FILES): uxkern/bsd_types_gen.h uxkern/bsd_1.defs
  306.      $(MIG) $(_MIGFLAGS_)\
  307.         -header /dev/null \
  308.         -user /dev/null \
  309.         -server uxkern/bsd_1_server.c \
  310.          ${uxkern/bsd_1.defs:P}
  311.  
  312. uxkern/bsd_types_gen.h : bsd_types_gen
  313.     ./bsd_types_gen > uxkern/bsd_types_gen.h
  314.  
  315. bsd_types_gen : bsd_types_gen.o
  316.     ${_host_CC_} -o bsd_types_gen bsd_types_gen.o
  317.  
  318. bsd_types_gen.o : uxkern/bsd_types_gen.c
  319.     ${_host_CC_} -c ${_CCFLAGS_} ${uxkern/bsd_types_gen.c:P}
  320.  
  321. gprof: kgmon_on all kgmon_off
  322.  
  323. kgmon_on:
  324.     kgmon -r -b
  325.  
  326. kgmon_off:
  327.     kgmon -h -p
  328.     gprof /mach >GPROF
  329.  
  330. kern/init_sysent.c kern/syscalls.c sys/syscall.h: kern/makesyscalls.sh kern/syscalls.master
  331.     -rm -rf kern sys
  332.     -mkdir sys kern
  333.     cd kern;/bin/sh ../${kern/makesyscalls.sh:P} ../${kern/syscalls.master:P}
  334.  
  335.  
  336. #
  337. #  Run "lint" on the current build directory.  This will often be done
  338. #  with a special configuration that defines the union of all options
  339. #  used in all configurations so that all combinations are checked.
  340. #  The LINTFILES variable allows lint to be easily run on an optional
  341. #  sub-set of files specified on the make command line when this is
  342. #  desired.
  343. #
  344.  
  345. LINTFILES= ${CFILES} ioconf.c
  346.  
  347. lint:    ALWAYS 
  348.     @lint -n -hbxn -DGENERIC ${LINTOPTS} ${LINTFILES} \
  349.         ${machine/swapgeneric.c:P} | \
  350.         egrep -v 'struct/union .* never defined' | \
  351.         egrep -v 'possible pointer alignment problem'
  352.  
  353. ALWAYS:
  354.  
  355.  
  356. symbols.sort: ${KERN_MACHINE_DIR}/symbols.raw
  357.     -grep -v '^#' ${${KERN_MACHINE_DIR}/symbols.raw:P} \
  358.         | sed 's/^    //' | sort -u > symbols.tmp
  359.     -mv -f symbols.tmp symbols.sort
  360.  
  361. printenv:
  362.     @echo VPATH=${VPATH}
  363.     @echo INCDIRS=${INCDIRS}
  364.  
  365. .if exists(depend.mk)
  366. .include "depend.mk"
  367. .endif
  368.  
  369.