xref: /openbsd/sys/arch/amd64/stand/cdboot/Makefile (revision 7b36286a)
1#	$OpenBSD: Makefile,v 1.11 2007/11/25 18:25:30 deraadt Exp $
2
3.include "${.CURDIR}/../Makefile.inc"
4
5MAN=	cdboot.8
6
7.if ${MACHINE} == "amd64"
8S	=${.CURDIR}/../../../..
9SADIR=	${.CURDIR}/..
10
11PROG=	cdboot
12SRCS=	srt0.S boot.c conf.c
13LD?=	ld
14SIZE?=	size
15LDFLAGS+=-melf_i386 -nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -noinhibit-exec
16LDFLAGS+=-L/usr/libdata
17INSTALL_STRIP=
18
19.PATH:	${SADIR}/libsa
20# i386 stuff (so, it will possibly load in the same 64k)
21SRCS+=	machdep.c dev_i386.c exec_i386.c cmd_i386.c
22SRCS+=	gidt.S alloca.S biosdev.c bioscons.c gateA20.c \
23	memprobe.c diskprobe.c time.c ## biosprobe.c
24
25.PATH:	${S}/stand/boot
26SRCS+=	cmd.c vars.c bootarg.c
27
28.PATH:	${S}/lib/libsa
29SRCS+=	alloc.c exit.c strcmp.c strlen.c \
30	strncmp.c memcmp.c memcpy.c memset.c printf.c snprintf.c \
31	strerror.c strncpy.c strtol.c strtoll.c ctime.c strlcpy.c
32SRCS+=	close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c lseek.c \
33	open.c read.c stat.c cread.c readdir.c cons.c loadfile.c \
34	elf32.c elf64.c
35SRCS+=	ufs.c cd9660.c
36
37.PATH:	${S}/lib/libkern/arch/i386 ${S}/lib/libkern
38SRCS+=	divdi3.c moddi3.c qdivrem.c
39
40.PATH:	${S}/lib/libz
41SRCS+=	adler32.c crc32.c inflate.c inftrees.c
42
43#LDADD=	${LIBSA} ${LIBZ}
44#DPADD=	${LIBSA} ${LIBZ}
45
46${PROG}: $(OBJS) $(DPADD)
47	$(LD) $(LDFLAGS) -o ${PROG} $(OBJS) $(LDADD)
48	@$(SIZE) $(PROG)
49	@if [ -x ${.OBJDIR}/${PROG} ]; then \
50		objcopy -O binary ${PROG} ${.OBJDIR}/.tmp;\
51		mv -f ${.OBJDIR}/.tmp ${.OBJDIR}/${PROG}; \
52		ls -l ${.OBJDIR}/${PROG}; \
53	fi
54
55.else
56NOPROG=
57.endif
58
59.include <bsd.prog.mk>
60
61CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC) ${DEBUGFLAGS}
62CPPFLAGS+=-DSLOW -DSMALL -DNOBYFOUR -DNO_GZIP -DDYNAMIC_CRC_TABLE
63CPPFLAGS+=-DLINKADDR=${LINKADDR} -I${S}/stand/boot
64CFLAGS+=-m32 ${SACFLAGS} -D__INTERNAL_LIBSA_CREAD
65CFLAGS+=-DOSREV=\"${OSREV}\" -DMACHINE=\"${MACHINE}\"
66CFLAGS+=-DKERNEL=\"/${OSREV}/${MACHINE}/bsd.rd\"
67AFLAGS+=-m32
68