Makefile revision 1.4
11.148Scgd# $NetBSD: Makefile,v 1.4 2023/01/13 18:43:43 martin Exp $ 21.100Scgd 31.11SderaadtNODEBUG=yes 41.135SmycroftPROG= xxboot 51.119SmycroftNOMAN= # defined 61.119SmycroftSRCS= start.S main.c readufs.c readufs_ffs.c readufs_lfs.c milli_tiny.S 71.119Smycroft 81.113Smycroft.PATH: ${.CURDIR}/../common 91.113Smycroft 101.113SmycroftCPPFLAGS+= -I${.CURDIR}/../../../.. -I. -D_STANDALONE 111.113Smycroft# configuration for readufs module 121.113SmycroftCPPFLAGS+= -DUSE_LFS -DUSE_FFS -DUSE_UFS1 -DUSE_UFS2 131.113Smycroft# IODC can handle only 2GB, so this is enough 141.113SmycroftCPPFLAGS+= -D__daddr_t=int32_t -D__ino_t=uint32_t 151.113Smycroft# ANSI C feature prevents from being relocatable 161.113Smycroft#CPPFLAGS+= -traditional # would be best 171.113SmycroftCPPFLAGS+= -Dconst= 181.113SmycroftCOPTS+= -Os -fno-delete-null-pointer-checks -funsigned-char -mdisable-fpregs -mpa-risc-1-0 191.135Smycroft 201.113Smycroft.include <bsd.own.mk> 211.113Smycroft 221.113SmycroftLINKS= ${BINDIR}/${PROG} ${BINDIR}/sdboot 231.135Smycroft 241.135SmycroftBINDIR= /usr/mdec 251.135SmycroftSTRIPFLAG= 261.135SmycroftBINMODE= 444 271.135Smycroft 281.135Smycroft# standalone program 291.135SmycroftLIBCRTBEGIN= 301.135SmycroftLIBCRT0= 311.135SmycroftLIBCRTI= 321.135SmycroftLIBCRTEND= 331.1ScgdLIBC= 341.1Scgd 351.29SmycroftS= ${.CURDIR}/../../../.. 361.29Smycroft 371.43Smycroft${PROG}: iplsum ${OBJS} 381.29Smycroft ${_MKTARGET_LINK} 391.29Smycroft ${LD} -Ttext 0 -Tdata 0 -e '$$START$$' -N -o $@1 $(OBJS) 401.29Smycroft ${LD} -Ttext 0x100 -Tdata 0x23456780 -e '$$START$$' -N -o $@2 $(OBJS) 411.29Smycroft ${SIZE} $@1 421.29Smycroft ${OBJCOPY} -O binary -j .data $@1 $@1.bin 431.29Smycroft ${OBJCOPY} -O binary -j .data $@2 $@2.bin 441.29Smycroft cmp $@1.bin $@2.bin # should be same 451.64Smycroft ${OBJCOPY} -O binary -j .text $@1 $@2.bin 461.94Smycroft test ! -s $@2.bin # text section must be empty 471.94Smycroft ${_MKMSG} " iplsum " ${.TARGET} 481.29Smycroft ./iplsum $@1.bin $@ 491.29Smycroft 501.29Smycroftiplsum: iplsum.c 511.29Smycroft ${_MKTARGET_LINK} 521.29Smycroft ${HOST_CC} -o $@ ${.CURDIR}/iplsum.c 531.29Smycroft 541.29SmycroftCLEANFILES+= ${PROG}1 ${PROG}2 ${PROG}1.bin ${PROG}2.bin ${PROG}.bin iplsum 551.139ScgdCLEANFILES+= ${SRCS:M*.c:S/.c$/.o.S/} 561.146Smycroft 571.130Scgd.include <bsd.prog.mk> 581.1Scgd.include <bsd.klinks.mk> 591.98Smycroft 601.98Smycroft# override default rules 611.19Sderaadt 621.135Smycroft# Place code to data section. 631.135Smycroft.S.o: 641.89Smycroft ${_MKTARGET_COMPILE} 651.64Smycroft ${TOOL_SED} -e 's/\.code/.data/' \ 661.69Smycroft -e 's/\.bss/.section .bss,"aw",@nobits/' \ 671.51Smycroft -e 's/\.allow$$/.level 1.0/' -e 's/\.allow/.level/' \ 681.23Sderaadt ${.IMPSRC} | ${AS} -o ${.TARGET} 691.135Smycroft 701.1Scgd# Place code to data section, and make sure all address calculations 711.92Scgd# are relative to $global$. 721.92Scgd.c.o: 731.92Scgd ${_MKTARGET_COMPILE} 741.92Scgd ${CC} ${CFLAGS} ${CPPFLAGS} -o $@.S -S ${.IMPSRC} 751.92Scgd grep -i 'ldil' $@.S | egrep -v "ldil L'-?[0-9]*," > /dev/null 2>&1; \ 761.1Scgd if [ $$? = 0 ]; then \ 771.64Smycroft echo 'found non-relocatable code' >&2 && exit 1; \ 781.64Smycroft fi 791.144Sthorpej ${TOOL_SED} -e 's/\.text/.data/' $@.S | ${AS} -o ${.TARGET} 801.9Sderaadt