etc/protocols - sync with NetBSD-8
[minix.git] / sys / arch / i386 / stand / boot / Makefile.boot
blobb6c3d501e19f8ae0340eb96195366719965e5485
1 # $NetBSD: Makefile.boot,v 1.67 2015/08/20 11:39:28 uebayasi 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 LIBCRTI=        # nothing
28 LIBCRTBEGIN=    # nothing
29 LIBCRTEND=      # nothing
30 LIBC=           # nothing
32 BINDIR=/usr/mdec
33 BINMODE=444
35 .PATH:  ${.CURDIR}/.. ${.CURDIR}/../../lib
37 LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
38 CPPFLAGS+= -I ${.CURDIR}/..  -I ${.CURDIR}/../../lib -I ${S}/lib/libsa
39 CPPFLAGS+= -I ${.OBJDIR}
40 # Make sure we override any optimization options specified by the user
41 COPTS=  -Os
43 .if ${MACHINE_ARCH} == "x86_64"
44 LDFLAGS+=  -Wl,-m,elf_i386
45 AFLAGS+=   -m32
46 CPUFLAGS=  -m32
47 LIBKERN_ARCH=i386
48 KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
49 .else
50 CPUFLAGS=  -march=i386 -mtune=i386
51 .endif
53 CFLAGS+=   -mno-sse -mno-sse2 -mno-sse3
55 COPTS+=    -ffreestanding
56 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
57 CPPFLAGS+= -nostdinc -D_STANDALONE
58 CPPFLAGS+= -I$S
60 CPPFLAGS+= -DSUPPORT_PS2
61 CPPFLAGS+= -DDIRECT_SERIAL
62 CPPFLAGS+= -DSUPPORT_SERIAL=boot_params.bp_consdev
64 CPPFLAGS+= -DCONSPEED=boot_params.bp_conspeed
65 CPPFLAGS+= -DCONSADDR=boot_params.bp_consaddr
66 CPPFLAGS+= -DCONSOLE_KEYMAP=boot_params.bp_keymap
68 CPPFLAGS+= -DSUPPORT_CD9660
69 CPPFLAGS+= -DSUPPORT_USTARFS
70 CPPFLAGS+= -DSUPPORT_DOSFS
71 CPPFLAGS+= -DSUPPORT_EXT2FS
72 CPPFLAGS+= -DSUPPORT_MINIXFS3
73 CPPFLAGS+= -DPASS_BIOSGEOM
74 CPPFLAGS+= -DPASS_MEMMAP
75 #CPPFLAGS+= -DBOOTPASSWD
76 CPPFLAGS+= -DEPIA_HACK
77 #CPPFLAGS+= -DDEBUG_MEMSIZE
78 #CPPFLAGS+= -DBOOT_MSG_COM0
79 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
80 .if defined(__MINIX)
81 CPPFLAGS+= -DLIBSA_ENABLE_LOAD_MODS_OP
82 .endif # defined(__MINIX)
84 # The biosboot code is linked to 'virtual' address of zero and is
85 # loaded at physical address 0x10000.
86 # XXX The heap values should be determined from _end.
87 SAMISCCPPFLAGS+= -DHEAP_START=0x40000 -DHEAP_LIMIT=0x70000
88 SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
89 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes      # Read compressed kernels
90 SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no     # Netboot via TFTP, NFS
92 CPPFLAGS+=      -Wno-pointer-sign
94 # CPPFLAGS+= -DBOOTXX_RAID1_SUPPORT
96 I386_STAND_DIR?= $S/arch/i386/stand
98 ### find out what to use for libi386
99 I386DIR= ${I386_STAND_DIR}/lib
100 .include "${I386DIR}/Makefile.inc"
101 LIBI386= ${I386LIB}
103 ### find out what to use for libsa
104 SA_AS= library
105 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
106 SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=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 USE_BITCODE=no
119 # use MINIX minc
120 LIBKERN= ${DESTDIR}/usr/lib/libminc.a
121 .endif # !defined(__MINIX)
123 ### find out what to use for libz
124 Z_AS= library
125 .include "${S}/lib/libz/Makefile.inc"
126 LIBZ= ${ZLIB}
128 LDSCRIPT ?= $S/arch/i386/conf/stand.ldscript
130 cleandir distclean: .WAIT cleanlibdir
132 cleanlibdir:
133         -rm -rf lib
135 LIBLIST= ${LIBI386} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386} ${LIBSA}
136 # LIBLIST= ${LIBSA} ${LIBKERN} ${LIBI386} ${LIBSA} ${LIBZ} ${LIBKERN}
138 CLEANFILES+= ${PROG}.tmp ${PROG}.map ${PROG}.sym vers.c
140 vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot
141         ${HOST_SH} ${S}/conf/newvers_stand.sh ${VERSIONFILE} x86 ${NEWVERSWHAT}
143 .if defined(__MINIX)
144 # BJG
145 # -Wl,-Ttext,0 changed to --section-start=.text=0 twice below of a gold problem.
146 # did not leave both versions in because of the huge continued line.
147 .endif # defined(__MINIX)
149 # Anything that calls 'real_to_prot' must have a %pc < 0x10000.
150 # We link the program, find the callers (all in libi386), then
151 # explicitly pull in the required objects before any other library code.
152 ${PROG}: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.boot
153         ${_MKTARGET_LINK}
154         bb="$$( ${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,--section-start=.text=0 -Wl,-cref \
155             ${OBJS} ${LIBLIST} | ( \
156                 while read symbol file; do \
157                         [ -z "$$file" ] && continue; \
158                         [ "$$symbol" = real_to_prot ] && break; \
159                 done; \
160                 while \
161                         oifs="$$IFS"; \
162                         IFS='()'; \
163                         set -- $$file; \
164                         IFS="$$oifs"; \
165                         [ -n "$$2" ] && echo "${I386DST}/$$2"; \
166                         read file rest && [ -z "$$rest" ]; \
167                 do :; \
168                 done; \
169         ) )"; \
170         ${CC} -o ${PROG}.sym ${LDFLAGS} -Wl,--section-start=.text=0 -T ${LDSCRIPT} \
171                 -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST}
172         ${OBJCOPY} -O binary ${PROG}.sym ${PROG}
174 .include <bsd.prog.mk>
175 KLINK_MACHINE=  i386
176 .include <bsd.klinks.mk>