1 1.1.10.2 tls # $NetBSD: Makefile,v 1.1.10.3 2017/12/03 11:36:17 jdolecek Exp $ 2 1.1.10.2 tls 3 1.1.10.3 jdolecek NODEBUG=yes 4 1.1.10.2 tls PROG= xxboot 5 1.1.10.2 tls NOMAN= # defined 6 1.1.10.2 tls SRCS= start.S main.c readufs.c readufs_ffs.c readufs_lfs.c milli_tiny.S 7 1.1.10.2 tls 8 1.1.10.2 tls .PATH: ${.CURDIR}/../common 9 1.1.10.2 tls 10 1.1.10.2 tls CPPFLAGS+= -I${.CURDIR}/../../../.. -I. -D_STANDALONE 11 1.1.10.2 tls # configuration for readufs module 12 1.1.10.2 tls CPPFLAGS+= -DUSE_LFS -DUSE_FFS -DUSE_UFS1 -DUSE_UFS2 13 1.1.10.2 tls # IODC can handle only 2GB, so this is enough 14 1.1.10.2 tls CPPFLAGS+= -D__daddr_t=int32_t 15 1.1.10.2 tls # ANSI C feature prevents from being relocatable 16 1.1.10.2 tls #CPPFLAGS+= -traditional # would be best 17 1.1.10.2 tls CPPFLAGS+= -Dconst= 18 1.1.10.2 tls COPTS+= -Os -funsigned-char -mdisable-fpregs -mpa-risc-1-0 19 1.1.10.2 tls 20 1.1.10.2 tls .include <bsd.own.mk> 21 1.1.10.2 tls 22 1.1.10.2 tls LINKS= ${BINDIR}/${PROG} ${BINDIR}/sdboot 23 1.1.10.2 tls 24 1.1.10.2 tls BINDIR= /usr/mdec 25 1.1.10.2 tls STRIPFLAG= 26 1.1.10.2 tls BINMODE= 444 27 1.1.10.2 tls 28 1.1.10.2 tls # standalone program 29 1.1.10.2 tls LIBCRTBEGIN= 30 1.1.10.2 tls LIBCRT0= 31 1.1.10.2 tls LIBCRTI= 32 1.1.10.2 tls LIBCRTEND= 33 1.1.10.2 tls LIBC= 34 1.1.10.2 tls 35 1.1.10.2 tls S= ${.CURDIR}/../../../.. 36 1.1.10.2 tls 37 1.1.10.2 tls ${PROG}: iplsum ${OBJS} 38 1.1.10.2 tls ${_MKTARGET_LINK} 39 1.1.10.2 tls ${LD} -Ttext 0 -Tdata 0 -e '$$START$$' -N -o $@1 $(OBJS) 40 1.1.10.2 tls ${LD} -Ttext 0x100 -Tdata 0x23456780 -e '$$START$$' -N -o $@2 $(OBJS) 41 1.1.10.2 tls ${SIZE} $@1 42 1.1.10.2 tls ${OBJCOPY} -O binary -j .data $@1 $@1.bin 43 1.1.10.2 tls ${OBJCOPY} -O binary -j .data $@2 $@2.bin 44 1.1.10.2 tls cmp $@1.bin $@2.bin # should be same 45 1.1.10.2 tls ${OBJCOPY} -O binary -j .text $@1 $@2.bin 46 1.1.10.2 tls test ! -s $@2.bin # text section must be empty 47 1.1.10.2 tls ${_MKMSG} " iplsum " ${.TARGET} 48 1.1.10.2 tls ./iplsum $@1.bin $@ 49 1.1.10.2 tls 50 1.1.10.2 tls iplsum: iplsum.c 51 1.1.10.2 tls ${_MKTARGET_LINK} 52 1.1.10.2 tls ${HOST_CC} -o $@ ${.CURDIR}/iplsum.c 53 1.1.10.2 tls 54 1.1.10.2 tls CLEANFILES+= ${PROG}1 ${PROG}2 ${PROG}1.bin ${PROG}2.bin ${PROG}.bin iplsum 55 1.1.10.2 tls CLEANFILES+= ${SRCS:M*.c:S/.c$/.o.S/} 56 1.1.10.2 tls 57 1.1.10.2 tls .include <bsd.prog.mk> 58 1.1.10.2 tls .include <bsd.klinks.mk> 59 1.1.10.2 tls 60 1.1.10.2 tls # override default rules 61 1.1.10.2 tls 62 1.1.10.2 tls # Place code to data section. 63 1.1.10.2 tls .S.o: 64 1.1.10.2 tls ${_MKTARGET_COMPILE} 65 1.1.10.2 tls ${TOOL_SED} -e 's/\.code/.data/' \ 66 1.1.10.2 tls -e 's/\.bss/.section .bss,"aw",@nobits/' \ 67 1.1.10.2 tls -e 's/\.allow$$/.level 1.0/' -e 's/\.allow/.level/' \ 68 1.1.10.2 tls ${.IMPSRC} | ${AS} -o ${.TARGET} 69 1.1.10.2 tls 70 1.1.10.2 tls # Place code to data section, and make sure all address calculations 71 1.1.10.2 tls # are relative to $global$. 72 1.1.10.2 tls .c.o: 73 1.1.10.2 tls ${_MKTARGET_COMPILE} 74 1.1.10.2 tls ${CC} ${CFLAGS} ${CPPFLAGS} -o $@.S -S ${.IMPSRC} 75 1.1.10.2 tls grep -i 'ldil' $@.S | egrep -v "ldil L'-?[0-9]*," > /dev/null 2>&1; \ 76 1.1.10.2 tls if [ $$? = 0 ]; then \ 77 1.1.10.2 tls echo 'found non-relocatable code' >&2 && exit 1; \ 78 1.1.10.2 tls fi 79 1.1.10.2 tls ${TOOL_SED} -e 's/\.text/.data/' $@.S | ${AS} -o ${.TARGET} 80