tools/llvm: Do not build with symbols
[minix3.git] / sys / arch / i386 / stand / boot / Makefile.boot
blob5eb6569ae4ad7075555b4a476658f51d490546dd
1 # $NetBSD: Makefile.boot,v 1.60 2013/08/21 17:15:26 matt Exp $
3 S=      ${.CURDIR}/../../../../..
5 NOMAN=
6 PROG?= boot
7 NEWVERSWHAT?= "BIOS Boot"
8 VERSIONFILE?= ${.CURDIR}/../version
10 AFLAGS.biosboot.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
12 SOURCES?= biosboot.S boot2.c conf.c devopen.c exec.c
13 SRCS= ${SOURCES}
14 .if !make(depend)
15 SRCS+= vers.c
16 .endif
18 PIE_CFLAGS=
19 PIE_AFLAGS=
20 PIE_LDFLAGS=
22 .include <bsd.own.mk>
24 STRIPFLAG=      # nothing
26 LIBCRT0=        # nothing
27 LIBCRTBEGIN=    # nothing
28 LIBCRTEND=      # nothing
29 LIBC=           # nothing
31 BINDIR=/usr/mdec
32 BINMODE=444
34 .PATH:  ${.CURDIR}/.. ${.CURDIR}/../../lib
36 LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
37 CPPFLAGS+= -I ${.CURDIR}/..  -I ${.CURDIR}/../../lib -I ${S}/lib/libsa
38 CPPFLAGS+= -I ${.OBJDIR}
39 # Make sure we override any optimization options specified by the user
40 COPTS=  -Os
42 .if ${MACHINE_ARCH} == "x86_64"
43 LDFLAGS+=  -Wl,-m,elf_i386
44 AFLAGS+=   -m32
45 CPUFLAGS=  -m32
46 LIBKERN_ARCH=i386
47 KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
48 .else
49 CPUFLAGS=  -march=i386 -mtune=i386
50 .endif
52 CFLAGS+=   -mno-sse -mno-sse2 -mno-sse3
54 COPTS+=    -ffreestanding
55 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
56 CPPFLAGS+= -nostdinc -D_STANDALONE
57 CPPFLAGS+= -I$S
59 CPPFLAGS+= -DSUPPORT_PS2
60 CPPFLAGS+= -DDIRECT_SERIAL
61 CPPFLAGS+= -DSUPPORT_SERIAL=boot_params.bp_consdev
63 CPPFLAGS+= -DCONSPEED=boot_params.bp_conspeed
64 CPPFLAGS+= -DCONSADDR=boot_params.bp_consaddr
65 CPPFLAGS+= -DCONSOLE_KEYMAP=boot_params.bp_keymap
67 CPPFLAGS+= -DSUPPORT_CD9660
68 CPPFLAGS+= -DSUPPORT_USTARFS
69 CPPFLAGS+= -DSUPPORT_DOSFS
70 CPPFLAGS+= -DSUPPORT_EXT2FS
71 CPPFLAGS+= -DSUPPORT_MINIXFS3
72 CPPFLAGS+= -DPASS_BIOSGEOM
73 CPPFLAGS+= -DPASS_MEMMAP
74 #CPPFLAGS+= -DBOOTPASSWD
75 CPPFLAGS+= -DEPIA_HACK
76 #CPPFLAGS+= -DDEBUG_MEMSIZE
77 #CPPFLAGS+= -DBOOT_MSG_COM0
78 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
80 # The biosboot code is linked to 'virtual' address of zero and is
81 # loaded at physical address 0x10000.
82 # XXX The heap values should be determined from _end.
83 SAMISCCPPFLAGS+= -DHEAP_START=0x40000 -DHEAP_LIMIT=0x70000
84 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
85 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes      # Read compressed kernels
86 SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no     # Netboot via TFTP, NFS
88 CPPFLAGS+=      -Wno-pointer-sign
90 # CPPFLAGS+= -DBOOTXX_RAID1_SUPPORT
92 I386_STAND_DIR?= $S/arch/i386/stand
94 ### find out what to use for libi386
95 I386DIR= ${I386_STAND_DIR}/lib
96 .include "${I386DIR}/Makefile.inc"
97 LIBI386= ${I386LIB}
99 ### find out what to use for libsa
100 SA_AS= library
101 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
102 SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
103 .include "${S}/lib/libsa/Makefile.inc"
104 LIBSA= ${SALIB}
106 .ifndef __MINIX
107 ### find out what to use for libkern
108 KERN_AS= library
109 .include "${S}/lib/libkern/Makefile.inc"
110 LIBKERN= ${KERNLIB}
111 .else
113 USE_BITCODE=no
115 # use MINIX minc
116 LIBKERN= ${DESTDIR}/usr/lib/libminc.a
117 .endif
119 ### find out what to use for libz
120 Z_AS= library
121 .include "${S}/lib/libz/Makefile.inc"
122 LIBZ= ${ZLIB}
125 cleandir distclean: .WAIT cleanlibdir
127 cleanlibdir:
128         -rm -rf lib
130 LIBLIST= ${LIBI386} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} ${LIBSA}
131 # LIBLIST= ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} ${LIBZ} ${LIBKERN}
133 CLEANFILES+= ${PROG}.tmp ${PROG}.map ${PROG}.syms vers.c
135 vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot
136         ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT}
138 .if defined(__MINIX)
139 # BJG
140 # -Wl,-Ttext,0 changed to --section-start=.text=0 twice below of a gold problem.
141 # did not leave both versions in because of the huge continued line.
142 .endif
144 # Anything that calls 'real_to_prot' must have a %pc < 0x10000.
145 # We link the program, find the callers (all in libi386), then
146 # explicitly pull in the required objects before any other library code.
147 ${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
148         ${_MKTARGET_LINK}
149         bb="$$( ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,--section-start=.text=0 -Wl,-cref \
150             ${OBJS} ${LIBLIST} | ( \
151                 while read symbol file; do \
152                         [ -z "$$file" ] && continue; \
153                         [ "$$symbol" = real_to_prot ] && break; \
154                 done; \
155                 while \
156                         oifs="$$IFS"; \
157                         IFS='()'; \
158                         set -- $$file; \
159                         IFS="$$oifs"; \
160                         [ -n "$$2" ] && echo "${I386DST}/$$2"; \
161                         read file rest && [ -z "$$rest" ]; \
162                 do :; \
163                 done; \
164         ) )"; \
165         ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,--section-start=.text=0 \
166                 -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST}
167         ${OBJCOPY} -O binary ${PROG}.syms ${PROG}
169 .include <bsd.prog.mk>
170 KLINK_MACHINE=  i386
171 .include <bsd.klinks.mk>