Makefile revision 1.5
11.5Sskrll# $NetBSD: Makefile,v 1.5 2024/04/29 07:31:18 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.4SmartinCPPFLAGS+= -D__daddr_t=int32_t -D__ino_t=uint32_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.5Sskrll# Make sure we override any optimization options specified by the user 211.5SskrllDBG= # empty 221.5Sskrll 231.1Sskrll.include <bsd.own.mk> 241.1Sskrll 251.1SskrllLINKS= ${BINDIR}/${PROG} ${BINDIR}/sdboot 261.1Sskrll 271.1SskrllBINDIR= /usr/mdec 281.1SskrllSTRIPFLAG= 291.1SskrllBINMODE= 444 301.1Sskrll 311.1Sskrll# standalone program 321.1SskrllLIBCRTBEGIN= 331.1SskrllLIBCRT0= 341.1SskrllLIBCRTI= 351.1SskrllLIBCRTEND= 361.1SskrllLIBC= 371.1Sskrll 381.1SskrllS= ${.CURDIR}/../../../.. 391.1Sskrll 401.1Sskrll${PROG}: iplsum ${OBJS} 411.1Sskrll ${_MKTARGET_LINK} 421.1Sskrll ${LD} -Ttext 0 -Tdata 0 -e '$$START$$' -N -o $@1 $(OBJS) 431.1Sskrll ${LD} -Ttext 0x100 -Tdata 0x23456780 -e '$$START$$' -N -o $@2 $(OBJS) 441.1Sskrll ${SIZE} $@1 451.1Sskrll ${OBJCOPY} -O binary -j .data $@1 $@1.bin 461.1Sskrll ${OBJCOPY} -O binary -j .data $@2 $@2.bin 471.1Sskrll cmp $@1.bin $@2.bin # should be same 481.1Sskrll ${OBJCOPY} -O binary -j .text $@1 $@2.bin 491.1Sskrll test ! -s $@2.bin # text section must be empty 501.1Sskrll ${_MKMSG} " iplsum " ${.TARGET} 511.1Sskrll ./iplsum $@1.bin $@ 521.1Sskrll 531.1Sskrlliplsum: iplsum.c 541.1Sskrll ${_MKTARGET_LINK} 551.1Sskrll ${HOST_CC} -o $@ ${.CURDIR}/iplsum.c 561.1Sskrll 571.1SskrllCLEANFILES+= ${PROG}1 ${PROG}2 ${PROG}1.bin ${PROG}2.bin ${PROG}.bin iplsum 581.1SskrllCLEANFILES+= ${SRCS:M*.c:S/.c$/.o.S/} 591.1Sskrll 601.1Sskrll.include <bsd.prog.mk> 611.1Sskrll.include <bsd.klinks.mk> 621.1Sskrll 631.1Sskrll# override default rules 641.1Sskrll 651.1Sskrll# Place code to data section. 661.1Sskrll.S.o: 671.1Sskrll ${_MKTARGET_COMPILE} 681.1Sskrll ${TOOL_SED} -e 's/\.code/.data/' \ 691.1Sskrll -e 's/\.bss/.section .bss,"aw",@nobits/' \ 701.1Sskrll -e 's/\.allow$$/.level 1.0/' -e 's/\.allow/.level/' \ 711.1Sskrll ${.IMPSRC} | ${AS} -o ${.TARGET} 721.1Sskrll 731.1Sskrll# Place code to data section, and make sure all address calculations 741.1Sskrll# are relative to $global$. 751.1Sskrll.c.o: 761.1Sskrll ${_MKTARGET_COMPILE} 771.1Sskrll ${CC} ${CFLAGS} ${CPPFLAGS} -o $@.S -S ${.IMPSRC} 781.1Sskrll grep -i 'ldil' $@.S | egrep -v "ldil L'-?[0-9]*," > /dev/null 2>&1; \ 791.1Sskrll if [ $$? = 0 ]; then \ 801.1Sskrll echo 'found non-relocatable code' >&2 && exit 1; \ 811.1Sskrll fi 821.1Sskrll ${TOOL_SED} -e 's/\.text/.data/' $@.S | ${AS} -o ${.TARGET} 83