-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (39 loc) · 1.3 KB
/
Makefile
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
CFLAGS := -std=gnu99 -Wall -Wextra
objects := main.o metadata.o common.o images.o file_dev_ops.o crypt_md5.o fat_driver.o tools.o mount.o
files := main.c metadata.c common.c images.c file_dev_ops.c crypt_md5.c fat/fat_driver.c tools.c mount.c
ASM_DIR := asm
COMMON_FLAGS := -I./
RELEASE_FLAGS := -DNDEBUG $(COMMON_FLAGS)
DEBUG_FLAGS := -O0 -ggdb3 -Weverything $(COMMON_FLAGS)
.PHONY: all
all:
$(CC) $(CFLAGS) -g $(RELEASE_FLAGS) -c $(files)
$(CC) $(CFLAGS) -g $(RELEASE_FLAGS) -o gordon $(objects)
.PHONY: install
install: all
install -d $(DESTDIR)$(PREFIX)/usr/bin/
install -m 0755 gordon $(DESTDIR)$(PREFIX)/usr/bin/gordon
.PHONY: debug
debug:
$(CC) $(CFLAGS) $(DEBUG_FLAGS) -c $(files)
$(CC) $(CFLAGS) $(DEBUG_FLAGS) -o gordon $(objects)
.PHONY: all-boot-code
all-boot-code: bootcode
$(CC) -DBOOT_CODE $(CFLAGS) $(RELEASE_FLAGS) -c $(files)
$(CC) -DBOOT_CODE $(CFLAGS) $(RELEASE_FLAGS) -o gordon $(objects)
.PHONY: debug-boot-code
debug-boot-code: bootcode
$(CC) -DBOOT_CODE $(CFLAGS) $(DEBUG_FLAGS) -c $(files)
$(CC) -DBOOT_CODE $(CFLAGS) $(DEBUG_FLAGS) -o gordon $(objects)
.PHONY: bootcode
bootcode:
$(MAKE) -C $(ASM_DIR)
.PHONY: clean
clean:
rm -f *.o
rm -f gordon
.PHONY: test-boot
test-boot: all-boot-code
touch disk.img
./gordon -d ./disk.img -s0 -f
qemu-system-i386 -cpu 486 -fda ./disk.img