Home | History | Annotate | Line # | Download | only in conf
Makefile.sparc revision 1.9
      1 # from:	@(#)Makefile.sparc	8.1 (Berkeley) 7/19/93
      2 # $Id: Makefile.sparc,v 1.9 1994/05/05 07:50:04 deraadt Exp $
      3 # Makefile for 4.4 BSD
      4 #
      5 # This makefile is constructed from a machine description:
      6 #	config machineid
      7 # Most changes should be made in the machine description
      8 #	/sys/conf/``machineid''
      9 # after which you should do
     10 #	 config machineid
     11 # Machine generic makefile changes should be made in
     12 #	/sys/conf/Makefile.``machinetype''
     13 # after which config should be rerun for all machines of that type.
     14 #
     15 # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
     16 #	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
     17 #
     18 # -DTRACE	compile in kernel tracing hooks
     19 # -DQUOTA	compile in file system quotas
     20 
     21 # DEBUG is set to -g if debugging.
     22 # PROF is set to -pg if profiling.
     23 
     24 AS?=	as
     25 
     26 CC=	cc ${DEBUG}
     27 CPP=	cpp
     28 LD=	ld
     29 TOUCH=	touch -f -c
     30 
     31 # source tree is located via $S relative to the compilation directory
     32 S=	../../../..
     33 SPARC=	../..
     34 
     35 INCLUDES= -I. -I$S/arch -I$S -I$S/sys
     36 COPTS=	${INCLUDES} ${IDENT} -DKERNEL
     37 CFLAGS=	${COPTS}
     38 
     39 ### find out what to use for libkern
     40 .include "$S/lib/libkern/Makefile.inc"
     41 .ifndef PROF
     42 LIBKERN=	${KERNLIB}
     43 .else
     44 LIBKERN=	${KERNLIB_PROF}
     45 .endif
     46 
     47 # compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
     48 # where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
     49 # capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
     50 # is marked as config-dependent.
     51 
     52 # sparc kernel uses volatile, rather than heavy "device-driver"s.
     53 
     54 NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
     55 NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
     56 
     57 # optimizer breaks sometimes; temporary workaround uses ${NOOPT_C}
     58 NOOPT_C=	${CC} -c ${COPTS} ${PROF} ${PARAM} $<
     59 
     60 NORMAL_S=	rm -f $*.c; ln -s $< $*.c; \
     61 		${CC} ${COPTS} -I${SPARC}/sparc -E $*.c > $*.i; \
     62 		${AS} -o $@ $*.i; rm -f $*.c $*.i
     63 NORMAL_S_C=	rm -f $*.c; ln -s $< $*.c; \
     64 		${CC} ${COPTS} ${PARAM} -I${SPARC}/sparc -E $*.c > $*.i; \
     65 		${AS} -o $@ $*.i; rm -f $*.c $*.i
     66 
     67 %OBJS
     68 
     69 %CFILES
     70 
     71 # load lines for config "xxx" will be emitted as:
     72 # xxx: ${SYSTEM_DEP} swapxxx.o
     73 #	${SYSTEM_LD_HEAD}
     74 #	${SYSTEM_LD} swapxxx.o
     75 #	${SYSTEM_LD_TAIL}
     76 DEBUG?=
     77 .if ${DEBUG} == "-g"
     78 LDX=-X
     79 .else
     80 LDX=-x
     81 .endif
     82 SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o ${LIBKERN}
     83 .ifdef PROF
     84 SYSTEM_OBJ+=	subr_mcount.o
     85 .endif
     86 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
     87 SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
     88 SYSTEM_LD=	@${LD} ${LDX} -p -N -e start -T f8004000 -o $@ \
     89 		    ${SYSTEM_OBJ} vers.o
     90 SYSTEM_LD_TAIL=	@echo rearranging symbols; size $@; chmod 755 $@
     91 #.if ${DEBUG} == "-g"
     92 #SYSTEM_LD_TAIL+=; echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
     93 #		echo strip -d $@; strip -d $@
     94 #.endif
     95 
     96 %LOAD
     97 
     98 newvers:
     99 	sh $S/conf/newvers.sh
    100 	${CC} ${CFLAGS} -c vers.c
    101 
    102 clean:
    103 	rm -f eddep *netbsd netbsd.gdb tags tags1 *.[io] [a-z]*.s \
    104 		Errs errs linterrs makelinks
    105 
    106 locore.o: ${SPARC}/sparc/locore.s assym.s
    107 	${NORMAL_S}
    108 
    109 # depend on maxusers
    110 assym.s: Makefile
    111 
    112 ./assym.s: assym.s
    113 assym.s: genassym
    114 	./genassym >assym.s
    115 
    116 genassym: genassym.o
    117 	${CC} -static -o $@ genassym.o
    118 
    119 genassym.o: ${SPARC}/sparc/genassym.c
    120 	${CC} -c ${CFLAGS} -I/usr/include ${PARAM} $<
    121 
    122 SRCS= ${CFILES} ioconf.c param.c
    123 depend: .depend
    124 .depend: ${SRCS} assym.s
    125 	mkdep ${COPTS} ${SRCS}
    126 	mkdep -a -p ${COPTS} ${SPARC}/sparc/genassym.c 
    127 
    128 links:
    129 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    130 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    131 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    132 	  sort -u | comm -23 - dontlink | \
    133 	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
    134 	sh makelinks && rm -f dontlink
    135 
    136 tags: depend
    137 	sh $S/conf/systags.sh
    138 	rm -f tags1
    139 	sed -e 's,	../,	,' tags > tags1
    140 
    141 ioconf.o: ioconf.c
    142 	${CC} -c ${CFLAGS} ioconf.c
    143 
    144 param.c: $S/conf/param.c
    145 	rm -f param.c
    146 	cp $S/conf/param.c .
    147 
    148 param.o: param.c Makefile
    149 	${CC} -c ${CFLAGS} ${PARAM} param.c
    150 
    151 .ifdef PROF
    152 subr_mcount.o: $S/kern/subr_mcount.c
    153 	${CC} -c ${CFLAGS} $S/kern/subr_mcount.c
    154 .endif
    155 
    156 %RULES
    157 
    158 # DO NOT DELETE THIS LINE -- make depend uses it
    159 
    160