1 #
2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
5 # 1.0 of the CDDL.
6 #
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
10 #
11
12 #
13 # Copyright 2015 Toomas Soome <tsoome@me.com>
14 #
15
16 include $(SRC)/Makefile.master
17
18 ROOT_BOOT = $(ROOT)/boot
19
20 LD= $(GNU_ROOT)/bin/gld
21 CC= $(GCC_ROOT)/bin/gcc
22
23 CFLAGS = -Os -I../common -march=i386 -ffreestanding -mno-mmx -mno-3dnow
24 CFLAGS += -mno-sse -mno-sse2 -mno-sse3 -msoft-float -std=gnu99 -m32
25 CPPFLAGS=
26 CCASFLAGS= -Wa,--divide
27
28 PROG= cdboot
29 STRIP=
30 FILEMODE=0444
31 MAN=
32 SRCS= ${PROG}.S
33 OBJS= $(SRCS:%.S=%.o)
34
35
36 ORG= 0x7c00
37
38 LDFLAGS=-e start -Ttext ${ORG} -N -S --oformat binary
39
40 all: ${PROG}
41
42 install: $(PROG:%=$(ROOT_BOOT)/%)
43
44 ${PROG}: ${OBJS}
45 ${LD} ${LDFLAGS} -o $@ $^
46
47 clobber: clean
48 clean:
49 $(RM) $(PROG) $(OBJS)
50
51 .S.o:
52 $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $<
53
54 $(ROOT_BOOT)/%: %
55 $(INS.file)