-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (36 loc) · 677 Bytes
/
Makefile
File metadata and controls
44 lines (36 loc) · 677 Bytes
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
CC=clang
LD=ld
ASM_BIN=uuz-asm
C_BIN=uuz-c
ASM_SRC=src-asm
C_SRC=src-c
ASMFLAGS=
CFLAGS=-Wall -Wextra -Werror -pedantic -std=c2x -march=native
LDFLAGS=
ifdef DEBUG
CFLAGS+=-g
ASMFLAGS+=-g -DDEBUG
else ifdef DEBUGO3
CFLAGS+=-g -O3
else
CFLAGS+=-s -O3
LDFLAGS+=-s
endif
ifdef DRYRUN
ASMFLAGS+= -DDRYRUN
endif
.PHONY: all clean
all: $(ASM_BIN) $(C_BIN)
$(ASM_BIN).o: $(ASM_SRC)/$(ASM_BIN).S $(ASM_SRC)/*.inc Makefile
$(CC) $(ASMFLAGS) -c $< -o $@
$(ASM_BIN): $(ASM_BIN).o
$(LD) $(LDFLAGS) -n $< -o $@
ifndef DEBUG
objcopy -R '.*' --keep-section '.text' $@
endif
$(C_BIN): $(C_SRC)/*.c
$(CC) $(CFLAGS) $? -o $@
clean:
rm -f $(ASM_BIN)
rm -f $(C_BIN)
rm -f *.o