-
Notifications
You must be signed in to change notification settings - Fork 2
/
common_defs.mk
64 lines (52 loc) · 1.47 KB
/
common_defs.mk
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
#=============================================================================
#
# Makefile - Common Definitions
#
#=============================================================================
CC = gcc
AS = as
LD = ld
AR = ar
AROPT = rcsv
ASOPT = -g --32 -I../inc
ASOPT += --defsym __DHBW_KERNEL__=1
NASM = nasm
NASMOPT = -g -f elf -F dwarf
CFLAGS = -m32 -Wall -Werror -Wextra -g -Og -std=gnu99
CFLAGS += -D__DHBW_KERNEL__
CFLAGS += -fno-omit-frame-pointer -fno-stack-protector -fno-inline
CFLAGS += -nostdlib -nostdinc -static
LDFLAGS = -melf_i386 --warn-common --fatal-warnings -n
PS2PDF = ps2pdf
A2PS = a2ps
AOPT = --line-numbers=1
DDOPT = conv=notrunc status=noxfer
FLP_USF_POS := 66
FLP_ELF_POS := 322
FLP_TOC_POS := 2878
define update-image
@if [ ! -f $1 ]; then \
mkdosfs -C $1 1440 > /dev/null 2>&1 ; \
fi;
@echo DD $1
@if [ -f $(BOOTLOADER) ]; then \
dd $(DDOPT) if=$(BOOTLOADER) of=$1 ; \
dd $(DDOPT) if=$2 of=$1 seek=$3 ; \
else \
echo "Error: file" $(BOOTLOADER) "does not exist" ; \
rm -f $1 ; \
fi;
endef
%.bin : %.elf
objcopy -O binary $< $@
%.sym : %.elf
objcopy --only-keep-debug $< $@
%.o : %.c
@echo CC $<
@$(CC) $(CFLAGS) -o $*.o -c $<
%.o %.lst : %.s
@echo AS $<
@$(AS) $(ASOPT) -almgns=$*.lst -o $*.o -c $<
%.o %.lst : %.asm
@echo NASM $<
@$(NASM) $(NASMOPT) -l $*.lst -o $@ $<