Home | History | Annotate | Line # | Download | only in conf
Makefile.atari revision 1.40
      1 #	$NetBSD: Makefile.atari,v 1.40 1997/11/12 22:25:47 thorpej Exp $
      2 
      3 # Makefile for NetBSD
      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/arch/atari/conf/``machineid''
      9 # after which you should do
     10 #	config machineid
     11 # Machine generic makefile changes should be made in
     12 #	/sys/arch/atari/conf/Makefile.atari
     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 CC?=	cc
     25 AS?=	as
     26 LD?=	ld
     27 LORDER?=lorder
     28 MKDEP?=	mkdep
     29 NM?=	nm
     30 SIZE?=	size
     31 STRIP?=	strip
     32 TSORT?=	tsort -q
     33 COPTS?=	-O2 -mc68020
     34 
     35 # source tree is located via $S relative to the compilation directory
     36 .ifndef S
     37 S!=	cd ../../../..; pwd
     38 .endif
     39 ATARI=	$S/arch/atari
     40 
     41 INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     42 CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
     43 		-Dmc68020 -Datari
     44 CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
     45 .if empty(IDENT:M-DM68060)
     46 CMACHFLAGS=	-m68020
     47 .else
     48 CMACHFLAGS=	-m68060 -Wa,-m68030
     49 .endif
     50 CFLAGS=		${DEBUG} ${CWARNFLAGS} ${COPTS} ${CMACHFLAGS} -msoft-float 
     51 AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
     52 LINKFLAGS=	-n -Ttext 0 -e start
     53 STRIPFLAGS=	-d
     54 
     55 HOSTED_CC=	${CC}
     56 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
     57 HOSTED_CFLAGS=	${CFLAGS}
     58 
     59 ### find out what to use for libkern
     60 .include "$S/lib/libkern/Makefile.inc"
     61 .ifndef PROF
     62 LIBKERN=	${KERNLIB}
     63 .else
     64 LIBKERN=	${KERNLIB_PROF}
     65 .endif
     66 
     67 ### find out what to use for libcompat
     68 .include "$S/compat/common/Makefile.inc"
     69 .ifndef PROF
     70 LIBCOMPAT=	${COMPATLIB}
     71 .else
     72 LIBCOMPAT=	${COMPATLIB_PROF}
     73 .endif
     74 
     75 ### for the Motorola 68040 Floating Point Software Product
     76 .include "$S/arch/m68k/fpsp/Makefile.inc"
     77 
     78 ### for the Motorola 68060 Software Support Package
     79 .include "$S/arch/m68k/060sp/Makefile.inc"
     80 
     81 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     82 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     83 
     84 NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     85 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
     86 
     87 HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
     88 
     89 %OBJS
     90 
     91 %CFILES
     92 
     93 %SFILES
     94 
     95 # load lines for config "xxx" will be emitted as:
     96 # xxx: ${SYSTEM_DEP} swapxxx.o
     97 #	${SYSTEM_LD_HEAD}
     98 #	${SYSTEM_LD} swapxxx.o
     99 #	${SYSTEM_LD_TAIL}
    100 SYSTEM_OBJ=	locore.o ${FPSP} \
    101 		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
    102 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    103 SYSTEM_LD_HEAD=	@rm -f $@
    104 SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    105 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    106 SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
    107 
    108 DEBUG?=
    109 .if ${DEBUG} == "-g"
    110 LINKFLAGS+=	-X
    111 SYSTEM_LD_TAIL+=; \
    112 		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
    113 		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
    114 .else
    115 LINKFLAGS+=	-S
    116 .endif
    117 
    118 %LOAD
    119 
    120 assym.h: ${ATARI}/atari/genassym.cf $S/kern/genassym.sh
    121 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \
    122 	< ${ATARI}/atari/genassym.cf >assym.h.tmp && \
    123 	mv -f assym.h.tmp assym.h
    124 
    125 param.c: $S/conf/param.c
    126 	rm -f param.c
    127 	cp $S/conf/param.c .
    128 
    129 param.o: param.c Makefile
    130 	${NORMAL_C}
    131 
    132 ioconf.o: ioconf.c
    133 	${NORMAL_C}
    134 
    135 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    136 	sh $S/conf/newvers.sh
    137 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    138 
    139 __CLEANKERNEL: .USE
    140 	@echo "${.TARGET}ing the kernel objects"
    141 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    142 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    143 
    144 __CLEANDEPEND: .USE
    145 	rm -f .depend
    146 
    147 clean: __CLEANKERNEL
    148 
    149 cleandir: __CLEANKERNEL __CLEANDEPEND
    150 
    151 lint:
    152 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    153 	    ${CFILES} ioconf.c param.c | \
    154 	    grep -v 'static function .* unused'
    155 
    156 tags:
    157 	@echo "see $S/kern/Makefile for tags"
    158 
    159 links:
    160 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    161 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    162 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    163 	  sort -u | comm -23 - dontlink | \
    164 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    165 	sh makelinks && rm -f dontlink
    166 
    167 SRCS=	${ATARI}/atari/locore.s \
    168 	param.c ioconf.c ${CFILES} ${SFILES}
    169 depend: .depend
    170 .depend: ${SRCS} assym.h param.c
    171 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ATARI}/atari/locore.s
    172 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    173 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    174 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    175 	  ${CPPFLAGS} < ${ATARI}/atari/genassym.cf
    176 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    177 	@rm -f assym.dep
    178 
    179 
    180 # depend on root or device configuration
    181 autoconf.o conf.o: Makefile
    182  
    183 # depend on network or filesystem configuration 
    184 uipc_proto.o vfs_conf.o: Makefile 
    185 
    186 # depend on maxusers
    187 machdep.o: Makefile
    188 
    189 # depend on CPU configuration 
    190 locore.o pmap.o sys_machdep.o: Makefile
    191 
    192 
    193 locore.o: ${ATARI}/atari/locore.s assym.h
    194 	${NORMAL_S}
    195 
    196 %RULES
    197