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