Home | History | Annotate | Line # | Download | only in conf
Makefile.news68k revision 1.11
      1  1.11      jmc #	$NetBSD: Makefile.news68k,v 1.11 2001/10/26 06:45:38 jmc Exp $
      2   1.1  tsutsui #
      3   1.1  tsutsui # Makefile for NetBSD
      4   1.1  tsutsui #
      5   1.1  tsutsui # This makefile is constructed from a machine description:
      6   1.1  tsutsui #	config machineid
      7   1.1  tsutsui # Most changes should be made in the machine description
      8   1.1  tsutsui #	/sys/arch/news68k/conf/``machineid''
      9   1.1  tsutsui # after which you should do
     10   1.1  tsutsui #	config machineid
     11   1.1  tsutsui # Machine generic makefile changes should be made in
     12   1.1  tsutsui #	/sys/arch/news68k/conf/Makefile.news68k
     13   1.1  tsutsui # after which config should be rerun for all machines of that type.
     14  1.10  thorpej 
     15  1.10  thorpej MACHINE_ARCH=m68k
     16  1.11      jmc USETOOLS?=	no
     17  1.11      jmc 
     18  1.11      jmc .include <bsd.own.mk>
     19   1.1  tsutsui 
     20   1.1  tsutsui # DEBUG is set to -g if debugging.
     21   1.1  tsutsui # PROF is set to -pg if profiling.
     22   1.1  tsutsui 
     23   1.1  tsutsui AR?=	ar
     24   1.1  tsutsui AS?=	as
     25   1.1  tsutsui CC?=	cc
     26   1.1  tsutsui CPP?=	cpp
     27   1.1  tsutsui LD?=	ld
     28   1.1  tsutsui LORDER?=lorder
     29   1.1  tsutsui MKDEP?=	mkdep
     30   1.1  tsutsui NM?=	nm
     31   1.1  tsutsui RANLIB?=ranlib
     32   1.1  tsutsui SIZE?=	size
     33   1.5  tsutsui STRIP?=	strip
     34   1.1  tsutsui TSORT?=	tsort -q
     35   1.1  tsutsui 
     36   1.1  tsutsui COPTS?=	-O2
     37   1.1  tsutsui 
     38   1.1  tsutsui # source tree is located via $S relative to the compilation directory
     39   1.1  tsutsui .ifndef S
     40   1.1  tsutsui #S!=	cd ../../../..; pwd
     41   1.1  tsutsui S=	../../../..
     42   1.1  tsutsui .endif
     43   1.1  tsutsui NEWS68K=$S/arch/news68k
     44   1.1  tsutsui 
     45   1.6  thorpej HAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 
     46   1.1  tsutsui INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     47   1.9      mrg CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dnews68k
     48   1.1  tsutsui CWARNFLAGS?=	-Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
     49   1.1  tsutsui 		-Wall -Werror
     50   1.6  thorpej # XXX Delete -Wuninitialized for now, since the compiler doesn't
     51   1.6  thorpej # XXX always get it right.  --thorpej 
     52   1.6  thorpej CWARNFLAGS+=	-Wno-uninitialized
     53   1.6  thorpej .if (${HAVE_EGCS} != "")
     54   1.1  tsutsui CWARNFLAGS+=	-Wno-main
     55   1.1  tsutsui .endif
     56   1.1  tsutsui CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
     57   1.1  tsutsui AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
     58   1.1  tsutsui LINKFLAGS=	-n -Ttext 0 -e start
     59   1.2  tsutsui STRIPFLAGS=	-g
     60   1.1  tsutsui 
     61   1.1  tsutsui %INCLUDES
     62   1.1  tsutsui 
     63   1.1  tsutsui HOSTED_CC=	${CC}
     64   1.1  tsutsui HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
     65   1.1  tsutsui HOSTED_CFLAGS=	${CFLAGS}
     66   1.1  tsutsui 
     67   1.1  tsutsui ### find out what to use for libkern
     68   1.1  tsutsui KERN_AS=	obj
     69   1.1  tsutsui .include "$S/lib/libkern/Makefile.inc"
     70   1.1  tsutsui .ifndef PROF
     71   1.1  tsutsui LIBKERN=	${KERNLIB}
     72   1.1  tsutsui .else
     73   1.1  tsutsui LIBKERN=	${KERNLIB_PROF}
     74   1.1  tsutsui .endif
     75   1.1  tsutsui 
     76   1.1  tsutsui ### find out what to use for libcompat
     77   1.1  tsutsui .include "$S/compat/common/Makefile.inc"
     78   1.1  tsutsui .ifndef PROF
     79   1.1  tsutsui LIBCOMPAT=	${COMPATLIB}
     80   1.1  tsutsui .else
     81   1.1  tsutsui LIBCOMPAT=	${COMPATLIB_PROF}
     82   1.1  tsutsui .endif
     83   1.1  tsutsui 
     84   1.1  tsutsui # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     85   1.1  tsutsui # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     86   1.1  tsutsui 
     87   1.1  tsutsui NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     88   1.1  tsutsui NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
     89   1.1  tsutsui NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
     90   1.1  tsutsui 
     91   1.1  tsutsui HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
     92   1.1  tsutsui 
     93   1.1  tsutsui %OBJS
     94   1.1  tsutsui 
     95   1.1  tsutsui %CFILES
     96   1.1  tsutsui 
     97   1.1  tsutsui %SFILES
     98   1.1  tsutsui 
     99   1.1  tsutsui # load lines for config "xxx" will be emitted as:
    100   1.1  tsutsui # xxx: ${SYSTEM_DEP} swapxxx.o
    101   1.1  tsutsui #	${SYSTEM_LD_HEAD}
    102   1.1  tsutsui #	${SYSTEM_LD} swapxxx.o
    103   1.1  tsutsui #	${SYSTEM_LD_TAIL}
    104   1.1  tsutsui SYSTEM_OBJ=	locore.o ${FPSP}
    105   1.1  tsutsui SYSTEM_OBJ+=	param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
    106   1.1  tsutsui SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    107   1.1  tsutsui SYSTEM_LD_HEAD=	@rm -f $@
    108   1.1  tsutsui SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o ; \
    109   1.1  tsutsui 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    110   1.1  tsutsui SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    111   1.1  tsutsui 
    112   1.1  tsutsui DEBUG?=
    113   1.1  tsutsui .if ${DEBUG} == "-g"
    114   1.1  tsutsui LINKFLAGS+=	-X
    115   1.1  tsutsui SYSTEM_LD_TAIL+=; \
    116   1.1  tsutsui 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    117   1.5  tsutsui 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    118   1.5  tsutsui 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    119   1.1  tsutsui .else
    120   1.1  tsutsui LINKFLAGS+=	-S
    121   1.1  tsutsui .endif
    122   1.1  tsutsui 
    123   1.1  tsutsui %LOAD
    124   1.1  tsutsui 
    125   1.1  tsutsui assym.h: $S/kern/genassym.sh ${NEWS68K}/news68k/genassym.cf
    126   1.1  tsutsui 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    127   1.1  tsutsui 	    < ${NEWS68K}/news68k/genassym.cf > assym.h.tmp && \
    128   1.1  tsutsui 	mv -f assym.h.tmp assym.h
    129   1.1  tsutsui 
    130   1.1  tsutsui 
    131   1.1  tsutsui param.c: $S/conf/param.c
    132   1.1  tsutsui 	rm -f param.c
    133   1.1  tsutsui 	cp $S/conf/param.c .
    134   1.1  tsutsui 
    135   1.1  tsutsui param.o: param.c Makefile
    136   1.1  tsutsui 	${NORMAL_C}
    137   1.1  tsutsui 
    138   1.1  tsutsui ioconf.o: ioconf.c
    139   1.1  tsutsui 	${NORMAL_C}
    140   1.1  tsutsui 
    141   1.1  tsutsui newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    142   1.1  tsutsui 	sh $S/conf/newvers.sh
    143   1.1  tsutsui 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    144   1.1  tsutsui 
    145   1.1  tsutsui __CLEANKERNEL: .USE
    146   1.1  tsutsui 	@echo "${.TARGET}ing the kernel objects"
    147   1.1  tsutsui 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    148   1.1  tsutsui 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    149   1.1  tsutsui 
    150   1.1  tsutsui __CLEANDEPEND: .USE
    151   1.1  tsutsui 	rm -f .depend
    152   1.1  tsutsui 
    153   1.1  tsutsui clean: __CLEANKERNEL
    154   1.1  tsutsui 
    155   1.1  tsutsui cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    156   1.1  tsutsui 
    157   1.1  tsutsui lint:
    158   1.1  tsutsui 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    159   1.1  tsutsui 	    ${CFILES} ioconf.c param.c | \
    160   1.1  tsutsui 	    grep -v 'static function .* unused'
    161   1.1  tsutsui 
    162   1.1  tsutsui tags:
    163   1.1  tsutsui 	@echo "see $S/kern/Makefile for tags"
    164   1.1  tsutsui 
    165   1.1  tsutsui links:
    166   1.1  tsutsui 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    167   1.1  tsutsui 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    168   1.1  tsutsui 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    169   1.1  tsutsui 	  sort -u | comm -23 - dontlink | \
    170   1.1  tsutsui 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    171   1.1  tsutsui 	sh makelinks && rm -f dontlink
    172   1.1  tsutsui 
    173   1.1  tsutsui SRCS=	${NEWS68K}/news68k/locore.s \
    174   1.1  tsutsui 	param.c ioconf.c ${CFILES} ${SFILES}
    175   1.1  tsutsui depend: .depend
    176   1.1  tsutsui .depend: ${SRCS} assym.h param.c
    177   1.1  tsutsui 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${NEWS68K}/news68k/locore.s
    178   1.1  tsutsui 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    179   1.1  tsutsui .if ${SFILES} != ""
    180   1.1  tsutsui 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    181   1.1  tsutsui .endif
    182   1.1  tsutsui 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    183   1.1  tsutsui 	  ${CPPFLAGS} < ${NEWS68K}/news68k/genassym.cf
    184   1.1  tsutsui 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    185   1.1  tsutsui 	@rm -f assym.dep
    186   1.4     tron 
    187   1.4     tron dependall: depend all
    188   1.1  tsutsui 
    189   1.1  tsutsui 
    190   1.1  tsutsui # depend on root or device configuration
    191   1.1  tsutsui autoconf.o conf.o: Makefile
    192   1.1  tsutsui  
    193   1.1  tsutsui # depend on network or filesystem configuration 
    194   1.1  tsutsui uipc_proto.o vfs_conf.o: Makefile 
    195   1.1  tsutsui 
    196   1.1  tsutsui # depend on maxusers
    197   1.1  tsutsui machdep.o: Makefile
    198   1.1  tsutsui 
    199   1.1  tsutsui # depend on CPU configuration 
    200   1.1  tsutsui machdep.o mainbus.o trap.o: Makefile
    201   1.1  tsutsui 
    202   1.1  tsutsui 
    203   1.1  tsutsui locore.o: ${NEWS68K}/news68k/locore.s assym.h
    204   1.1  tsutsui 	${NORMAL_S}
    205   1.7  hubertf 
    206   1.7  hubertf # The install target can be redefined by putting a
    207   1.7  hubertf # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    208   1.7  hubertf MACHINE_NAME!=  uname -n
    209   1.7  hubertf install: install-kernel-${MACHINE_NAME}
    210   1.7  hubertf .if !target(install-kernel-${MACHINE_NAME}})
    211   1.7  hubertf install-kernel-${MACHINE_NAME}:
    212   1.7  hubertf 	rm -f /onetbsd
    213   1.7  hubertf 	ln /netbsd /onetbsd
    214   1.7  hubertf 	cp netbsd /nnetbsd
    215   1.7  hubertf 	mv /nnetbsd /netbsd
    216   1.7  hubertf .endif
    217   1.1  tsutsui 
    218   1.1  tsutsui %RULES
    219