Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / i386 / stand / boot / Makefile.boot
blobd172289562a28b7ce46edffd0b297564bbd1997c
1 # $NetBSD: Makefile.boot,v 1.41 2009/11/18 20:33:39 dsl Exp $
3 S=      ${.CURDIR}/../../../../..
5 NOMAN=
6 PROG?= boot
7 NEWVERSWHAT?= "BIOS Boot"
8 VERSIONFILE?= ${.CURDIR}/../version
10 SOURCES?= biosboot.S boot2.c conf.c devopen.c exec.c
11 SRCS= ${SOURCES}
12 .if !make(depend)
13 SRCS+= vers.c
14 .endif
16 PIE_CFLAGS=
17 PIE_AFLAGS=
18 PIE_LDFLAGS=
20 .include <bsd.own.mk>
22 STRIPFLAG=      # nothing
24 LIBCRT0=        # nothing
25 LIBCRTBEGIN=    # nothing
26 LIBCRTEND=      # nothing
27 LIBC=           # nothing
29 BINDIR=/usr/mdec
30 BINMODE=444
32 .PATH:  ${.CURDIR}/.. ${.CURDIR}/../../lib
34 LDFLAGS+= -nostdlib -Wl,-N -Wl,-e,boot_start
35 # CPPFLAGS+= -D__daddr_t=int32_t
36 CPPFLAGS+= -I ${.CURDIR}/..  -I ${.CURDIR}/../../lib -I ${S}/lib/libsa
37 CPPFLAGS+= -I ${.OBJDIR}
38 #CPPFLAGS+= -DDEBUG_MEMSIZE
39 #CPPFLAGS+= -DBOOT_MSG_COM0
40 # Make sure we override any optimization options specified by the user
41 COPTS=  -Os
43 .if defined(HAVE_GCC)
44 .if ${MACHINE_ARCH} == "x86_64"
45 LDFLAGS+=  -Wl,-m,elf_i386
46 AFLAGS+=   -m32
47 CPUFLAGS=  -m32
48 LIBKERN_ARCH=i386
49 KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
50 .else
51 .if ${HAVE_GCC} == 3
52 CPUFLAGS=  -mcpu=i386
53 .else
54 CPUFLAGS=  -march=i386 -mtune=i386
55 .endif
56 .endif
57 .endif
59 COPTS+=    -ffreestanding
60 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
61 CPPFLAGS+= -nostdinc -D_STANDALONE
62 CPPFLAGS+= -I$S
64 CPPFLAGS+= -DSUPPORT_PS2
65 CPPFLAGS+= -DDIRECT_SERIAL
66 CPPFLAGS+= -DSUPPORT_SERIAL=boot_params.bp_consdev
68 CPPFLAGS+= -DCONSPEED=boot_params.bp_conspeed
69 CPPFLAGS+= -DCONSADDR=boot_params.bp_consaddr
70 CPPFLAGS+= -DCONSOLE_KEYMAP=boot_params.bp_keymap
72 CPPFLAGS+= -DSUPPORT_CD9660
73 CPPFLAGS+= -DSUPPORT_USTARFS
74 CPPFLAGS+= -DSUPPORT_DOSFS
75 #CPPFLAGS+= -DSUPPORT_EXT2FS
76 CPPFLAGS+= -DPASS_BIOSGEOM
77 CPPFLAGS+= -DPASS_MEMMAP
78 #CPPFLAGS+= -DBOOTPASSWD
79 CPPFLAGS+= -DEPIA_HACK
81 # The biosboot code is linked to 'virtual' address of zero and is
82 # loaded at physical address 0x10000.
83 # XXX The heap values should be determined from _end.
84 SAMISCCPPFLAGS+= -DHEAP_START=0x30000 -DHEAP_LIMIT=0x50000
85 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes      # Read compressed kernels
86 SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no     # Netboot via TFTP, NFS
88 .if (defined(HAVE_GCC) && ${HAVE_GCC} == 4) || defined(HAVE_PCC)
89 CPPFLAGS+=      -Wno-pointer-sign
90 .endif
92 # CPPFLAGS+= -DBOOTXX_RAID1_SUPPORT
94 I386_STAND_DIR?= $S/arch/i386/stand
96 CLEANFILES+= machine x86
98 .if !make(obj) && !make(clean) && !make(cleandir)
99 .BEGIN:
100         -rm -f machine && ln -s $S/arch/i386/include machine
101         -rm -f x86 && ln -s $S/arch/x86/include x86
102 .ifdef LIBOBJ
103         -rm -f lib && ln -s ${LIBOBJ}/lib lib
104         mkdir -p ${LIBOBJ}/lib
105 .endif
106 .endif
108 ### find out what to use for libi386
109 I386DIR= ${I386_STAND_DIR}/lib
110 .include "${I386DIR}/Makefile.inc"
111 LIBI386= ${I386LIB}
113 ### find out what to use for libsa
114 SA_AS= library
115 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
116 .include "${S}/lib/libsa/Makefile.inc"
117 LIBSA= ${SALIB}
119 ### find out what to use for libkern
120 KERN_AS= library
121 .include "${S}/lib/libkern/Makefile.inc"
122 LIBKERN= ${KERNLIB}
124 ### find out what to use for libz
125 Z_AS= library
126 .include "${S}/lib/libz/Makefile.inc"
127 LIBZ= ${ZLIB}
130 cleandir distclean: 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 vers.c
140 vers.c: ${VERSIONFILE} ${SOURCES} ${LIBLIST} ${.CURDIR}/../Makefile.boot
141         ${HOST_SH} ${S}/conf/newvers_stand.sh -DM ${VERSIONFILE} x86 ${NEWVERSWHAT}
143 # Anything that calls 'real_to_prot' must have a %pc < 0x10000.
144 # We link the program, find the callers (all in libi386), then
145 # explicitly pull in the required objects before any other library code.
146 ${PROG}: ${OBJS} ${LIBLIST} ${.CURDIR}/../Makefile.boot
147         ${_MKTARGET_LINK}
148         bb="$$( ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,-Ttext,0 -Wl,-cref \
149             ${OBJS} ${LIBLIST} | ( \
150                 while read symbol file; do \
151                         [ -z "$$file" ] && continue; \
152                         [ "$$symbol" = real_to_prot ] && break; \
153                 done; \
154                 while \
155                         oifs="$$IFS"; \
156                         IFS='()'; \
157                         set -- $$file; \
158                         IFS="$$oifs"; \
159                         [ -n "$$2" ] && echo "${I386DST}/$$2"; \
160                         read file rest && [ -z "$$rest" ]; \
161                 do :; \
162                 done; \
163         ) )"; \
164         ${CC} -o ${PROG}.syms ${LDFLAGS} -Wl,-Ttext,0 \
165                 -Wl,-Map,${PROG}.map -Wl,-cref ${OBJS} $$bb ${LIBLIST}
166         ${OBJCOPY} -O binary ${PROG}.syms ${PROG}
168 .include <bsd.prog.mk>