tools/llvm: Do not build with symbols
[minix3.git] / sys / arch / i386 / stand / bootxx / Makefile.bootxx
blob2b55ae4db2bc8222dce36f7a275e4ceba7c3dae4
1 # $NetBSD: Makefile.bootxx,v 1.46 2013/11/01 00:18:24 christos Exp $
3 S=      ${.CURDIR}/../../../../..
5 AFLAGS.bootxx.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
6 AFLAGS.label.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
7 AFLAGS.pbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
8 .if defined(__MINIX)
9 AFLAGS.bootxx.S+= -Wa,--divide
10 .endif
12 PIE_CFLAGS=
13 PIE_LDFLAGS=
14 PIE_AFLAGS=
15 NOMAN=
16 PROG?= bootxx_${FS}
17 BINDIR= /usr/mdec
18 BINMODE= 0444
20 PRIMARY_LOAD_ADDRESS=0x1000
21 SECONDARY_LOAD_ADDRESS=0x10000
23 # We ought (need?) to fit into track 0 of a 1.2M floppy.
24 # This restricts us to 15 sectors (including pbr and label)
25 BOOTXX_SECTORS?=15
26 BOOTXX_MAXSIZE?= $$(( ${BOOTXX_SECTORS} * 512 ))
28 SRCS= pbr.S label.S bootxx.S boot1.c
30 .include <bsd.own.mk>
32 STRIPFLAG=      # nothing
34 LIBCRT0=        # nothing
35 LIBCRTBEGIN=    # nothing
36 LIBCRTEND=      # nothing
37 LIBC=           # nothing
39 BINDIR=/usr/mdec
40 BINMODE=444
42 .PATH:  ${.CURDIR}/.. ${.CURDIR}/../../lib
44 LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,start
45 CPPFLAGS+= -DBOOTXX
46 # CPPFLAGS+= -D__daddr_t=int32_t
47 CPPFLAGS+= -I ${.CURDIR}/../../lib -I ${.OBJDIR}
48 CPPFLAGS+= -DBOOTXX_SECTORS=${BOOTXX_SECTORS}
49 CPPFLAGS+= -DPRIMARY_LOAD_ADDRESS=${PRIMARY_LOAD_ADDRESS}
50 CPPFLAGS+= -DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS}
51 CPPFLAGS+= -DXXfs_open=${FS}_open
52 CPPFLAGS+= -DXXfs_close=${FS}_close
53 CPPFLAGS+= -DXXfs_read=${FS}_read
54 CPPFLAGS+= -DXXfs_stat=${FS}_stat
55 CPPFLAGS+= -DFS=${FS}
56 # CPPFLAGS+= -DBOOT_MSG_COM0
58 # Make sure we override any optimization options specified by the user
59 .include "${.PARSEDIR}/../Makefile.inc"
60 COPTS=  ${OPT_SIZE.${ACTIVE_CC}}
61 DBG=
63 CPPFLAGS+= -DNO_LBA_CHECK
65 .if ${MACHINE_ARCH} == "x86_64"
66 LDFLAGS+=  -Wl,-m,elf_i386
67 AFLAGS+=   -m32
68 CPUFLAGS=  -m32
69 LIBKERN_ARCH=i386
70 KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
71 .else
72 CPPFLAGS+= -DEPIA_HACK
73 CPUFLAGS=  -march=i386 -mtune=i386
74 .endif
76 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
77 CPPFLAGS+= -nostdinc -D_STANDALONE
78 CPPFLAGS+= -I$S
80 CPPFLAGS+= -DLIBSA_SINGLE_FILESYSTEM=xxfs \
81                 -DLIBSA_NO_TWIDDLE \
82                 -DLIBSA_NO_FD_CHECKING \
83                 -DLIBSA_NO_RAW_ACCESS \
84                 -DLIBSA_NO_FS_WRITE \
85                 -DLIBSA_NO_FS_SEEK \
86                 -DLIBSA_SINGLE_DEVICE=blkdev \
87                 -DLIBKERN_OPTIMISE_SPACE \
88                 -D"blkdevioctl(x,y,z)=EINVAL" \
89                 -D"blkdevclose(f)=0" \
90                 -D"devopen(f,n,fl)=(*(fl)=(void *)n,0)" \
91                 -DLIBSA_NO_DISKLABEL_MSGS
93 # -DLIBSA_FS_SINGLECOMPONENT 
95 # CPPFLAGS+= -DBOOTXX_RAID1_SUPPORT
97 I386_STAND_DIR?= $S/arch/i386/stand
99 ### find out what to use for libi386
100 I386DIR= ${I386_STAND_DIR}/lib
101 .include "${I386DIR}/Makefile.inc"
102 LIBI386= ${I386LIB}
104 ### find out what to use for libsa
105 SA_AS= library
106 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
107 .include "${S}/lib/libsa/Makefile.inc"
108 LIBSA= ${SALIB}
110 .if !defined(__MINIX)
111 ### find out what to use for libkern
112 KERN_AS=        library
113 .include "${S}/lib/libkern/Makefile.inc"
114 LIBKERN=        ${KERNLIB}
115 .else
117 SAMISCMAKEFLAGS+="SA_INCLUDE_NET=no"
119 USE_BITCODE=no
121 # use MINIX minc
122 LIBKERN= ${DESTDIR}/usr/lib/libminc.a
123 .endif
125 LDSCRIPT ?= $S/arch/i386/conf/stand.ldscript
127 cleandir distclean: .WAIT cleanlibdir
129 cleanlibdir:
130         -rm -rf lib
132 LIBLIST= ${LIBI386} ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA}
134 CLEANFILES+= ${PROG}.sym ${PROG}.map
136 ${PROG}: ${OBJS} ${LIBLIST}
137         ${_MKTARGET_LINK}
138 .if defined(__MINIX)
139         ${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,--section-start=.text=${PRIMARY_LOAD_ADDRESS} \
140                 -T ${LDSCRIPT} -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST}
141 .else
142         ${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,-Ttext,${PRIMARY_LOAD_ADDRESS} \
143                 -T ${LDSCRIPT} -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} ${LIBLIST}
144 .endif
145         ${OBJCOPY} -O binary ${PROG}.sym ${PROG}
146         @ sz=$$(${TOOL_STAT} -f '%z' ${PROG}); \
147         if [ "$$sz" -gt "${BOOTXX_MAXSIZE}" ]; then \
148                 echo "### ${PROG} size $$sz is larger than ${BOOTXX_MAXSIZE}" >&2; \
149                 rm ${PROG}; \
150                 ! :; \
151         else \
152                 : pad to sector boundary; \
153                 pad=$$(( 512 - ( $$sz & 511 ) )); \
154                 [ $$pad = 512 ] || \
155                     dd if=/dev/zero bs=1 count=$$pad >>${PROG} 2>/dev/null; \
156                 echo "${PROG} size $$sz, $$((${BOOTXX_MAXSIZE} - $$sz)) free"; \
157         fi
159 .include <bsd.prog.mk>
160 KLINK_MACHINE=  i386
161 .include <bsd.klinks.mk>