Makefile revision 1.3
11.3Sskrll# $NetBSD: Makefile,v 1.3 2018/11/13 21:22:38 skrll Exp $ 21.1Sskrll 31.2SchristosNODEBUG=yes 41.1SskrllPROG= xxboot 51.1SskrllNOMAN= # defined 61.1SskrllSRCS= start.S main.c readufs.c readufs_ffs.c readufs_lfs.c milli_tiny.S 71.1Sskrll 81.1Sskrll.PATH: ${.CURDIR}/../common 91.1Sskrll 101.1SskrllCPPFLAGS+= -I${.CURDIR}/../../../.. -I. -D_STANDALONE 111.1Sskrll# configuration for readufs module 121.1SskrllCPPFLAGS+= -DUSE_LFS -DUSE_FFS -DUSE_UFS1 -DUSE_UFS2 131.1Sskrll# IODC can handle only 2GB, so this is enough 141.1SskrllCPPFLAGS+= -D__daddr_t=int32_t 151.1Sskrll# ANSI C feature prevents from being relocatable 161.1Sskrll#CPPFLAGS+= -traditional # would be best 171.1SskrllCPPFLAGS+= -Dconst= 181.3SskrllCOPTS+= -Os -fno-delete-null-pointer-checks -funsigned-char -mdisable-fpregs -mpa-risc-1-0 191.1Sskrll 201.1Sskrll.include <bsd.own.mk> 211.1Sskrll 221.1SskrllLINKS= ${BINDIR}/${PROG} ${BINDIR}/sdboot 231.1Sskrll 241.1SskrllBINDIR= /usr/mdec 251.1SskrllSTRIPFLAG= 261.1SskrllBINMODE= 444 271.1Sskrll 281.1Sskrll# standalone program 291.1SskrllLIBCRTBEGIN= 301.1SskrllLIBCRT0= 311.1SskrllLIBCRTI= 321.1SskrllLIBCRTEND= 331.1SskrllLIBC= 341.1Sskrll 351.1SskrllS= ${.CURDIR}/../../../.. 361.1Sskrll 371.1Sskrll${PROG}: iplsum ${OBJS} 381.1Sskrll ${_MKTARGET_LINK} 391.1Sskrll ${LD} -Ttext 0 -Tdata 0 -e '$$START$$' -N -o $@1 $(OBJS) 401.1Sskrll ${LD} -Ttext 0x100 -Tdata 0x23456780 -e '$$START$$' -N -o $@2 $(OBJS) 411.1Sskrll ${SIZE} $@1 421.1Sskrll ${OBJCOPY} -O binary -j .data $@1 $@1.bin 431.1Sskrll ${OBJCOPY} -O binary -j .data $@2 $@2.bin 441.1Sskrll cmp $@1.bin $@2.bin # should be same 451.1Sskrll ${OBJCOPY} -O binary -j .text $@1 $@2.bin 461.1Sskrll test ! -s $@2.bin # text section must be empty 471.1Sskrll ${_MKMSG} " iplsum " ${.TARGET} 481.1Sskrll ./iplsum $@1.bin $@ 491.1Sskrll 501.1Sskrlliplsum: iplsum.c 511.1Sskrll ${_MKTARGET_LINK} 521.1Sskrll ${HOST_CC} -o $@ ${.CURDIR}/iplsum.c 531.1Sskrll 541.1SskrllCLEANFILES+= ${PROG}1 ${PROG}2 ${PROG}1.bin ${PROG}2.bin ${PROG}.bin iplsum 551.1SskrllCLEANFILES+= ${SRCS:M*.c:S/.c$/.o.S/} 561.1Sskrll 571.1Sskrll.include <bsd.prog.mk> 581.1Sskrll.include <bsd.klinks.mk> 591.1Sskrll 601.1Sskrll# override default rules 611.1Sskrll 621.1Sskrll# Place code to data section. 631.1Sskrll.S.o: 641.1Sskrll ${_MKTARGET_COMPILE} 651.1Sskrll ${TOOL_SED} -e 's/\.code/.data/' \ 661.1Sskrll -e 's/\.bss/.section .bss,"aw",@nobits/' \ 671.1Sskrll -e 's/\.allow$$/.level 1.0/' -e 's/\.allow/.level/' \ 681.1Sskrll ${.IMPSRC} | ${AS} -o ${.TARGET} 691.1Sskrll 701.1Sskrll# Place code to data section, and make sure all address calculations 711.1Sskrll# are relative to $global$. 721.1Sskrll.c.o: 731.1Sskrll ${_MKTARGET_COMPILE} 741.1Sskrll ${CC} ${CFLAGS} ${CPPFLAGS} -o $@.S -S ${.IMPSRC} 751.1Sskrll grep -i 'ldil' $@.S | egrep -v "ldil L'-?[0-9]*," > /dev/null 2>&1; \ 761.1Sskrll if [ $$? = 0 ]; then \ 771.1Sskrll echo 'found non-relocatable code' >&2 && exit 1; \ 781.1Sskrll fi 791.1Sskrll ${TOOL_SED} -e 's/\.text/.data/' $@.S | ${AS} -o ${.TARGET} 80