summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/Makefile
blob: 21a8e36d79b099a066a2e77475e44431714d67af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Locations of utilities
#
ISOLINUX_BIN	= /usr/lib/syslinux/isolinux.bin

# i386-specific directories containing source files
#
SRCDIRS		+= arch/i386/core arch/i386/transitions arch/i386/prefix
SRCDIRS		+= arch/i386/firmware/pcbios
SRCDIRS		+= arch/i386/image
SRCDIRS		+= arch/i386/drivers/bus
SRCDIRS		+= arch/i386/drivers/net
SRCDIRS		+= arch/i386/drivers/disk
SRCDIRS		+= arch/i386/interface/pcbios
SRCDIRS		+= arch/i386/interface/pxe

# The various xxx_loader.c files are #included into core/loader.c and
# should not be compiled directly.
#
NON_AUTO_SRCS	+= arch/i386/core/aout_loader.c
NON_AUTO_SRCS	+= arch/i386/core/freebsd_loader.c
NON_AUTO_SRCS	+= arch/i386/core/wince_loader.c

# unnrv2b.S is used to generate a 16-bit as well as a 32-bit object.
#
OBJS_unnrv2b		= unnrv2b unnrv2b16
CFLAGS_unnrv2b16	= -DCODE16

# We need to undefine the default macro "i386" when compiling .S
# files, otherwise ".arch i386" translates to ".arch 1"...
#
CFLAGS_S		+= -Ui386

# The i386 linker script
#
LDSCRIPT		= arch/i386/scripts/i386.lds

# Media types.
# 
# It's ugly that we have to define these repetitive combinations by
# hand.  Unforunately, $(eval ...) is available only in make >= 3.80,
# and using an external Makefile fragment doesn't work because
# OBJS_xxx need to be defined *before* the external Makefile fragments
# for the source files are generated...

CFLAGS_ZPREFIX		= -DCOMPRESS

MEDIA			+= rom
OBJS_romprefix		= romprefix zromprefix
CFLAGS_zromprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= pxe
OBJS_pxeprefix		= pxeprefix zpxeprefix
CFLAGS_zpxeprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= elf
OBJS_elfprefix		= elfprefix zelfprefix
CFLAGS_zelfprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= elfd
OBJS_elfdprefix		= elfdprefix zelfdprefix
CFLAGS_zelfdprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= lmelf
OBJS_lmelfprefix	= lmelfprefix zlmelfprefix
CFLAGS_zlmelfprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= lmelfd
OBJS_lmelfdprefix	= lmelfdprefix zlmelfdprefix
CFLAGS_zlmelfdprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= lilo
OBJS_liloprefix		= liloprefix zliloprefix
CFLAGS_zliloprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= bImage
OBJS_bImageprefix	= bImageprefix zbImageprefix
CFLAGS_zbImageprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= dsk
OBJS_dskprefix		= dskprefix zdskprefix
CFLAGS_zdskprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= nbi
OBJS_nbiprefix		= nbiprefix znbiprefix
CFLAGS_znbiprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= hd
OBJS_hdprefix		= hdprefix zhdprefix
CFLAGS_zhdprefix	= $(CFLAGS_ZPREFIX)

MEDIA			+= raw
OBJS_rawprefix		= rawprefix zrawprefix
CFLAGS_zrawprefix	= $(CFLAGS_ZPREFIX)

# These media cannot handle compressed payloads

MEDIA			+= com

MEDIA			+= exe

# Special target for building Master Boot Record binary
$(BIN)/mbr.bin : $(BIN)/mbr.o
	$(OBJCOPY) -O binary $< $@

# Some suffixes (e.g. %.zfd0) are generated directly from other
# finished files (e.g. %.zdsk), rather than having their own prefix.

# rule to write disk images to /dev/fd0
NON_AUTO_MEDIA		+= fd0
%fd0 : %dsk
	dd if=$< bs=512 conv=sync of=/dev/fd0
	sync

# rule to create padded disk images
NON_AUTO_MEDIA		+= pdsk
%pdsk : %dsk
	cp $< $@
	$(PERL) ./util/dskpad.pl $@

# rule to make a non-emulation ISO boot image
NON_AUTO_MEDIA		+= iso
%iso:	%lilo util/geniso
	ISOLINUX_BIN=$(ISOLINUX_BIN) bash util/geniso $@ $<

# rule to make a floppy emulation ISO boot image
NON_AUTO_MEDIA		+= liso
%liso:	%lilo util/genliso
	bash util/genliso $@ $<

# rule to make a USB disk image
$(BIN)/usbdisk.bin : $(BIN)/usbdisk.o
	$(OBJCOPY) -O binary $< $@

NON_AUTO_MEDIA		+= usb
%usb: $(BIN)/usbdisk.bin %hd
	cat $^ > $@

# Add NON_AUTO_MEDIA to the media list, so that they show up in the
# output of "make"
#
MEDIA		+= $(NON_AUTO_MEDIA)

# Shortcut to allow typing just
#   make bin-kir/%
# rather than
#   make -f arch/i386/kir-Makefile bin-kir/%
# for building a KEEP_IT_REAL flavour.
#
$(BIN)-kir/% : kir-target
	$(MAKE) -f arch/i386/kir-Makefile $(MAKECMDGOALS)

.PHONY : kir-target