forked from id-Software/DOOM
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (34 loc) · 1.01 KB
/
Makefile
File metadata and controls
45 lines (34 loc) · 1.01 KB
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
ARCH ?= aarch64-none-elf
CC := $(ARCH)-gcc
CXX := $(ARCH)-g++
LD := $(ARCH)-ld
# Path to the [REDACTED] OS folder
OS_PATH ?= ../os
# Executable name
EXEC_NAME ?= $(notdir $(CURDIR))
# Path to the system's libshared. Static link only for now
STDINC ?= $(OS_PATH)/shared/
STDLIB ?= $(OS_PATH)/shared/libshared.a
CFLAGS ?= -ffreestanding -nostdlib -std=c99 -I$(STDINC) -O2
FS_PATH ?= $(OS_PATH)/fs/redos/user/
C_SOURCE ?= $(shell find redacteddoom/*.c)
OBJ ?= $(C_SOURCE:%.c=%.o)
.PHONY: dump
%.o : %.c
$(CC) $(CFLAGS) -c -c $< -o $@
$(EXEC_NAME): package $(OBJ)
$(LD) -T linker.ld -o $(EXEC_NAME).red/$(EXEC_NAME).elf $(OBJ) $(STDLIB)
all: $(EXEC_NAME)
package:
mkdir -p resources
mkdir -p $(EXEC_NAME).red
cp -r package.info $(EXEC_NAME).red/package.info
cp -r resources $(EXEC_NAME).red
run: all
cp -r $(EXEC_NAME).red $(FS_PATH)
(cd $(OS_PATH); ./createfs; ./run_virt)
clean:
rm $(OBJ)
rm -r $(EXEC_NAME).red
dump: all
$(ARCH)-objdump -D $(EXEC_NAME).red/$(EXEC_NAME).elf > dump