Home | History | Annotate | Line # | Download | only in boot
Makefile revision 1.42
      1  1.42      mrg #	$NetBSD: Makefile,v 1.42 2010/03/14 00:26:10 mrg Exp $
      2  1.34    lukem 
      3  1.34    lukem .include <bsd.sys.mk>		# for HOST_SH
      4   1.1       is 
      5   1.2       is ### what we need:
      6   1.1       is 
      7  1.38       is #XX# lines replace similar lines, or are added, in case we want to
      8  1.38       is #XX# compile LIBZ ourselves to save a few bytes (think TXLT)
      9  1.38       is 
     10  1.38       is #XX#DIR_LIBZ =	${DIR_TOP}/../common/dist/zlib
     11  1.38       is 
     12  1.10       is DIR_TOP=	${.CURDIR}/../../../../..
     13  1.10       is DIR_SA = 	${DIR_TOP}/lib/libsa
     14  1.38       is DIR_LIBZ=
     15  1.10       is DIR_KERN=	${DIR_TOP}/lib/libkern
     16  1.10       is DIR_KERN_MD=	${DIR_TOP}/lib/libkern/arch/$(MACHINE_ARCH)
     17  1.36       is DIR_LIBC=	${DIR_TOP}/../common/lib/libc
     18   1.1       is 
     19  1.36       is .PATH:  $(DIR_SA) ${DIR_LIBZ} $(DIR_KERN) $(DIR_KERN_MD) \
     20  1.36       is 	${DIR_LIBC}/gen ${DIR_LIBC}/arch/m68k/gen \
     21  1.36       is 	${DIR_LIBC}/inet ${DIR_LIBC}/arch/m68k/inet \
     22  1.36       is 	${DIR_LIBC}/quad ${DIR_LIBC}/arch/m68k/quad \
     23  1.36       is 	${DIR_LIBC}/string ${DIR_LIBC}/arch/m68k/string
     24   1.1       is 
     25  1.38       is ### find out what to use for libz
     26  1.38       is 
     27  1.38       is S=	${DIR_TOP}	# ????
     28  1.38       is Z_AS= library
     29  1.38       is .include "${DIR_TOP}/lib/libz/Makefile.inc"
     30  1.38       is LIBZ= ${ZLIB}
     31  1.38       is 
     32   1.2       is # prefer our assembler versions over assembler, and assembler over C:
     33   1.1       is 
     34   1.2       is .SUFFIXES:
     35  1.42      mrg .SUFFIXES: .out .o .po .pico .so .s .S .c .cc .C .f .y .l .ln .m4 .sh
     36   1.1       is 
     37  1.24   mhitch FILES= boot.amiga
     38  1.13    veego BINDIR=/usr/mdec
     39   1.1       is 
     40  1.15       is COBJS = main.o console.o xd.o twiddle.o bzero.o gets.o
     41  1.19       is COBJS+=  lseek.o open.o read.o close.o dev.o errno.o
     42  1.27   mhitch COBJS+=  ufs.o ustarfs.o panic.o vers.o files.o
     43  1.37       is COBJS+=  divdi3.o moddi3.o qdivrem.o
     44   1.1       is 
     45  1.23   mhitch SOBJS = alloc.o ashrdi3.o ashldi3.o bcopy.o muldi3.o printf.o startit.o
     46  1.38       is SOBJS += strlen.o memcmp.o memset.o strerror.o strncmp.o
     47  1.38       is SOBJS += libstubs.o
     48  1.37       is 
     49   1.2       is OBJS=	$(SOBJS) $(COBJS)
     50   1.1       is 
     51  1.41     elad #XX#DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DDYNAMIC_CRC_TABLE -DNOBYFOUR -UBYFOUR 
     52  1.41     elad DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER 
     53  1.24   mhitch DEFS += -D__INTERNAL_LIBSA_CREAD
     54  1.40  mlelstv #DEFS += -DSERCONSOLE
     55  1.24   mhitch SOBJS += cread.o
     56  1.38       is 
     57  1.38       is #XX#SOBJS += adler32.o crc32.o inflate.o trees.o \
     58  1.38       is #XX#       zutil.o infback.o inftrees.o inffast.o
     59  1.38       is 
     60  1.25  aymeric #DEFS += -DBOOT_ELF32 -DBOOT_AOUT
     61  1.24   mhitch SOBJS += loadfile.o loadfile_aout.o loadfile_elf32.o
     62  1.24   mhitch 
     63  1.34    lukem NETBSD_VERS!=	${HOST_SH} ${.CURDIR}/../../../../../conf/osrelease.sh
     64  1.24   mhitch DEFS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'
     65   1.1       is 
     66   1.2       is ### main target: ###
     67   1.1       is 
     68  1.24   mhitch realall: machine m68k ${FILES}
     69  1.24   mhitch 
     70  1.24   mhitch CLEANFILES += boot.amiga x.out xxstart.o libboot.a vers.c machine m68k
     71   1.1       is 
     72  1.18     tron .include <bsd.prog.mk>
     73  1.18     tron 
     74   1.2       is ### special  rules for bootblocks ###
     75   1.1       is 
     76  1.39  tsutsui INCPATH = -nostdinc -I${DIR_TOP} -I${DIR_TOP}/lib/libsa
     77  1.39  tsutsui INCPATH += -I${DIR_TOP}/../common/dist/zlib
     78  1.39  tsutsui INCPATH += -I${.CURDIR}
     79  1.24   mhitch INCPATH += -I${.CURDIR}/../../.. -I${.OBJDIR}
     80  1.39  tsutsui INCPATH += -I${.CURDIR}/../aout2bb
     81  1.10       is 
     82   1.2       is AFLAGS += -m68030 -l
     83  1.10       is CAFLAGS += -Wa,-l -Wa,-m68030 ${INCPATH}
     84   1.1       is 
     85  1.33   mhitch COPTIM= -Os -fomit-frame-pointer -fcse-follow-jumps -fcse-skip-blocks  -Wa,-l -m68060 -Wa,-m68030
     86  1.39  tsutsui CFLAGS= -ffreestanding ${COPTIM} ${INCPATH} ${DEFS}
     87  1.39  tsutsui CFLAGS+= -Werror
     88  1.39  tsutsui CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
     89   1.1       is 
     90   1.2       is .c.o:
     91  1.18     tron 	${CC} ${CFLAGS} -S $< -o $*.s
     92  1.18     tron 	${TXLT} < $*.s | ${AS} ${AFLAGS} -o $*.o
     93   1.2       is 	rm $*.s
     94   1.1       is 
     95  1.18     tron .s.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
     96   1.1       is 
     97  1.18     tron .S.o: ; ${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp -o $@ -c $<
     98   1.1       is 
     99  1.24   mhitch boot.amiga: x.out
    100  1.27   mhitch 	${RELOC2BB} -S x.out $@ || ${NM} -u x.out
    101   1.2       is 
    102  1.38       is x.out: xxstart.o libboot.a ${LIBZ}
    103  1.18     tron 	${LD} ${LDFLAGS} -r -dc -e _start -o $@ $>
    104  1.22   mhitch 	${SIZE} $@
    105  1.22   mhitch 	${NM} -u $@
    106   1.2       is 
    107   1.2       is xxstart.o: ${.CURDIR}/bbstart.s
    108  1.18     tron 	${CC} ${CAFLAGS} ${COPTS} -x assembler-with-cpp \
    109   1.2       is 		-o $@ -c $>
    110   1.2       is 
    111  1.18     tron libboot.a: ${OBJS}
    112  1.18     tron 	${AR} r $@ $> && ${RANLIB} $@
    113   1.2       is 
    114  1.24   mhitch .PHONY:	vers.c
    115  1.24   mhitch vers.c:	${.CURDIR}/version
    116  1.34    lukem 	${HOST_SH} ${DIR_TOP}/conf/newvers_stand.sh -N ${.CURDIR}/version "amiga"
    117  1.24   mhitch 
    118  1.39  tsutsui .if !make(obj) && !make(clean) && !make(cleandir)
    119  1.39  tsutsui .NOPATH: machine m68k
    120  1.39  tsutsui .BEGIN: machine m68k
    121  1.39  tsutsui 
    122  1.24   mhitch machine:
    123  1.24   mhitch 	-rm -f $@
    124  1.24   mhitch 	ln -s ${DIR_TOP}/arch/amiga/include $@
    125  1.24   mhitch 
    126  1.24   mhitch m68k:
    127  1.24   mhitch 	-rm -f $@
    128  1.24   mhitch 	ln -s ${DIR_TOP}/arch/m68k/include $@
    129  1.39  tsutsui .endif
    130  1.24   mhitch 
    131  1.10       is # make sure these are built:
    132   1.2       is 
    133  1.10       is ${COBJS}: ${TXLT}
    134  1.24   mhitch ${FILES}: ${RELOC2BB}
    135  1.26  aymeric 
    136  1.26  aymeric .include "${.CURDIR}/../Makefile.booters"
    137