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