Makefile.mac68k revision 1.27       1  1.27  thorpej #	$NetBSD: Makefile.mac68k,v 1.27 1996/01/14 21:06:51 thorpej Exp $
      2  1.12      cgd 
      3   1.1   briggs # Makefile for NetBSD for the mac
      4   1.1   briggs #	Derived from makefile for hp300 from NetBSD
      5   1.1   briggs #
      6   1.1   briggs # This makefile is constructed from a machine description:
      7   1.1   briggs #	config machineid
      8   1.1   briggs # Most changes should be made in the machine description
      9   1.1   briggs #	/sys/conf/``machineid''
     10   1.1   briggs # after which you should do
     11   1.1   briggs #	 config machineid
     12   1.1   briggs # Machine generic makefile changes should be made in
     13   1.1   briggs #	/sys/conf/Makefile.``machinetype''
     14   1.1   briggs # after which config should be rerun for all machines of that type.
     15   1.1   briggs #
     16   1.1   briggs # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
     17   1.1   briggs #	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
     18   1.1   briggs #
     19   1.1   briggs # -DTRACE	compile in kernel tracing hooks
     20   1.1   briggs # -DQUOTA	compile in file system quotas
     21   1.1   briggs 
     22  1.23   briggs # DEBUG is set to -g by "makeoptions DEBUG=-g"
     23   1.1   briggs # PROF is set to -pg by config if profiling is requested (config -p).
     24   1.8   briggs AS=	/usr/bin/as ${DEBUG}
     25   1.8   briggs CC=	/usr/bin/cc ${DEBUG}
     26   1.8   briggs LOCAL_CC=${CC}
     27   1.1   briggs CPP=	/usr/bin/cpp
     28   1.8   briggs LD=	/usr/bin/ld
     29   1.1   briggs TOUCH=	touch -f -c
     30   1.1   briggs GPROF.EX=/usr/src/lib/libc/csu.mac68k/gmon.ex
     31   1.1   briggs 
     32   1.1   briggs # source tree is located via $S relative to the compilation directory
     33   1.1   briggs S=	../../../..
     34   1.1   briggs MAC68K=	../..
     35  1.17   briggs 
     36  1.17   briggs INCLUDES= -I. -I$S/arch -I$S -I$S/sys
     37  1.17   briggs COPTS=	${INCLUDES} ${IDENT} -D_KERNEL -DREFBIT -Dmac68k
     38  1.26   briggs CFLAGS=	-O -Werror ${COPTS}
     39  1.17   briggs 
     40  1.17   briggs ### Find out what to use for libkern.
     41   1.1   briggs .include "$S/lib/libkern/Makefile.inc"
     42   1.1   briggs .ifndef PROF
     43   1.1   briggs LIBKERN=${KERNLIB}
     44   1.1   briggs .else
     45   1.1   briggs LIBKERN=${KERNLIB_PROF}
     46   1.1   briggs .endif
     47   1.1   briggs 
     48  1.20   briggs ### Find out what to use for libcompat.
     49  1.20   briggs .include "$S/compat/common/Makefile.inc"
     50  1.20   briggs .ifndef PROF
     51  1.21   briggs LIBCOMPAT=${COMPATLIB}
     52  1.20   briggs .else
     53  1.21   briggs LIBCOMPAT=${COMPATLIB_PROF}
     54  1.20   briggs .endif
     55  1.20   briggs 
     56   1.9   briggs ### for the Motorola 68040 Floating Point Software Product
     57   1.9   briggs .include "$S/arch/m68k/fpsp/Makefile.inc"
     58   1.1   briggs 
     59   1.1   briggs # compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
     60   1.1   briggs # where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
     61   1.1   briggs # capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
     62   1.1   briggs # is marked as config-dependent.
     63   1.1   briggs 
     64   1.1   briggs NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
     65   1.1   briggs NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
     66   1.1   briggs 
     67   1.1   briggs DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
     68   1.1   briggs DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
     69   1.1   briggs 
     70   1.1   briggs PROFILE_C=	${CC} -S -c ${COPTS} $<; \
     71   1.1   briggs 		ex - $*.s < ${GPROF.EX}; \
     72   1.1   briggs 		${AS} -o $@ $*.s; \
     73   1.1   briggs 		rm -f $*.s
     74   1.1   briggs 
     75   1.1   briggs # This really bites for now, but we need to run assembly through sed
     76   1.1   briggs # until the real problem (cpp, I think) is fixed.
     77   1.1   briggs NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
     78   1.1   briggs NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
     79   1.1   briggs 
     80   1.1   briggs %OBJS
     81   1.1   briggs 
     82   1.1   briggs %CFILES
     83   1.1   briggs 
     84   1.1   briggs # load lines for config "xxx" will be emitted as:
     85   1.1   briggs # xxx: ${SYSTEM_DEP} swapxxx.o
     86   1.1   briggs #	${SYSTEM_LD_HEAD}
     87   1.1   briggs #	${SYSTEM_LD} swapxxx.o
     88   1.1   briggs #	${SYSTEM_LD_TAIL}
     89  1.10   briggs SYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o conf.o \
     90  1.22   briggs 		${FPSP} ${LIBKERN} ${LIBCOMPAT}
     91   1.1   briggs SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
     92   1.1   briggs SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
     93   1.1   briggs SYSTEM_LD=	@strip=-x; [ X${DEBUG} = X-g ] && strip=-X || true; \
     94   1.3   briggs 		${LD} $$strip -n -T 0 -e start -o $@ \
     95  1.25   briggs 		${SYSTEM_OBJ} vers.o
     96   1.8   briggs SYSTEM_LD_TAIL=	@chmod 755 $@; size $@; \
     97   1.1   briggs 		[ X${DEBUG} = X-g ] && { \
     98   1.1   briggs 		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
     99   1.1   briggs 		echo strip -d $@; strip -d $@; } || true
    100   1.1   briggs 
    101   1.1   briggs %LOAD
    102   1.1   briggs 
    103   1.1   briggs newvers:
    104   1.1   briggs 	sh $S/conf/newvers.sh "${KERN_IDENT}" ${IDENT}
    105   1.1   briggs 	${CC} ${CFLAGS} -c vers.c
    106   1.1   briggs 
    107  1.19   briggs clean::
    108  1.18   briggs 	rm -f eddep netbsd tags *.o locore.i [a-z]*.s \
    109  1.27  thorpej 		vnode_if.[ch] Errs errs linterrs makelinks
    110   1.1   briggs 
    111   1.1   briggs lint: /tmp param.c
    112   1.1   briggs 	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
    113   1.1   briggs 	    ${MAC68K}/mac68k/Locore.c ${CFILES} \
    114   1.1   briggs 	    ioconf.c param.c| \
    115   1.1   briggs 	    grep -v 'struct/union .* never defined' | \
    116   1.1   briggs 	    grep -v 'possible pointer alignment problem'
    117   1.1   briggs 
    118   1.1   briggs symbols.sort: ${MAC68K}/mac68k/symbols.raw
    119   1.1   briggs 	grep -v '^#' ${MAC68K}/mac68k/symbols.raw \
    120   1.1   briggs 	    | sed 's/^	//' | sort -u > symbols.sort
    121   1.1   briggs 
    122  1.13   briggs locore.o: assym.s ${MAC68K}/mac68k/vectors.s ${MAC68K}/mac68k/macglobals.s
    123  1.13   briggs locore.o: ${MAC68K}/mac68k/locore.s 
    124  1.13   briggs locore.o: ${MAC68K}/include/trap.h ${MAC68K}/include/psl.h
    125  1.13   briggs locore.o: ${MAC68K}/include/pte.h ${MAC68K}/include/cpu.h
    126   1.1   briggs 	${CPP} -DLOCORE ${COPTS} ${MAC68K}/mac68k/locore.s | ${AS} -o locore.o
    127   1.1   briggs 
    128   1.1   briggs # the following is necessary because autoconf.o depends on #if GENERIC
    129   1.1   briggs autoconf.o: Makefile
    130   1.1   briggs 
    131   1.1   briggs # the following are necessary because the files depend on the types of
    132   1.1   briggs # hp cpu's included in the system configuration
    133   1.1   briggs clock.o machdep.o autoconf.o conf.o: Makefile
    134   1.1   briggs 
    135   1.1   briggs # depend on network configuration
    136   1.1   briggs af.o uipc_proto.o locore.o: Makefile
    137   1.1   briggs 
    138   1.1   briggs # depend on maxusers
    139   1.1   briggs assym.s: Makefile
    140   1.1   briggs 
    141   1.1   briggs assym.s: genassym
    142   1.1   briggs 	./genassym >assym.s
    143   1.1   briggs 
    144  1.16   briggs genassym: ${MAC68K}/mac68k/genassym.c
    145  1.15   briggs 	${LOCAL_CC} ${INCLUDES} ${IDENT} -D_KERNEL ${PARAM} -o genassym \
    146   1.1   briggs 	    ${MAC68K}/mac68k/genassym.c
    147   1.1   briggs 
    148   1.8   briggs depend: assym.s param.c vnode_if.h
    149   1.1   briggs 	mkdep ${COPTS} ${CFILES} ioconf.c param.c
    150   1.1   briggs 	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${MAC68K}/mac68k/genassym.c
    151   1.1   briggs 
    152   1.1   briggs links:
    153   1.1   briggs 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    154   1.1   briggs 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    155   1.1   briggs 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    156   1.1   briggs 	  sort -u | comm -23 - dontlink | \
    157   1.1   briggs 	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
    158   1.1   briggs 	sh makelinks && rm -f dontlink
    159   1.1   briggs 
    160   1.1   briggs tags:
    161   1.1   briggs 	@echo "see $S/kern/Makefile for tags"
    162   1.1   briggs 
    163   1.1   briggs ioconf.o: ioconf.c
    164   1.1   briggs 	${CC} -c ${CFLAGS} ioconf.c
    165   1.1   briggs 
    166   1.1   briggs conf.o: ${MAC68K}/mac68k/conf.c
    167   1.1   briggs 	${NORMAL_C}
    168   1.1   briggs 
    169   1.1   briggs param.c: $S/conf/param.c
    170   1.1   briggs 	rm -f param.c
    171   1.1   briggs 	cp $S/conf/param.c .
    172   1.1   briggs 
    173   1.1   briggs param.o: param.c Makefile
    174   1.1   briggs 	${CC} -c ${CFLAGS} ${PARAM} -DHZ=60 param.c
    175   1.8   briggs 
    176   1.8   briggs vnode_if.c vnode_if.h:  $S/kern/vnode_if.sh $S/kern/vnode_if.src
    177   1.8   briggs 	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
    178   1.1   briggs 
    179   1.1   briggs %RULES
    180