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