blob: a7396fb70c4a5bd32afafc39853b1d22e444ae16 (
plain)
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
|
#
# Makefile fragment for the bootstrap component of the system.
#
# THIS IS NOT A COMPLETE Makefile - run GNU make in the top-level
# directory, and this will be pulled in automatically.
#
SUBDIRS += boot
###################
# FILES SECTION #
###################
BOOT_SRC := boot/boot.S
BOOT_OBJ := $(BUILDDIR)/boot/boot.o
# BLDFLAGS := -Ttext 0x7c00 -s --oformat binary -e bootentry
# BLDFLAGS := -Ttext 0 -s --oformat binary -e bootentry
# BLDFLAGS := -N -Ttext 0x7c00 -s -e bootentry
BLDFLAGS := -N -Ttext 0 -s -e bootentry
###################
# RULES SECTION #
###################
bootstrap: $(BUILDDIR)/boot/boot
$(BUILDDIR)/boot/%.o: boot/%.c $(BUILDDIR)/.vars.CFLAGS
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILDDIR)/boot/%.o: boot/%.S $(BUILDDIR)/.vars.CFLAGS
@mkdir -p $(@D)
$(CPP) $(CPPFLAGS) -o $(@D)/$*.s $<
$(AS) $(ASFLAGS) -o $@ $(@D)/$*.s -a=$(@D)/$*.lst
$(RM) -f $(@D)/$*.s
$(NM) -n $@ > $(@D)/$*.sym
$(BUILDDIR)/boot/boot: $(BOOT_OBJ)
@mkdir -p $(@D)
$(LD) $(LDFLAGS) $(BLDFLAGS) -o $@.out $^
$(OBJCOPY) -S -O binary -j .text $@.out $@
|