-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
99 lines (83 loc) · 2.64 KB
/
Copy pathmakefile
File metadata and controls
99 lines (83 loc) · 2.64 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
MAKEFLAGS := -j
RELDIR := build
DEBDIR := build
SANDIR := build
MISCDIR := build
OBJDIR := /obj
SRCDIR := src
LIBDIRS := /usr/local/libc
LIBS := -lSDL3
CC := clang
CXX := clang++
CFLAGS := -MP -MMD -std=gnu23 -fwrapv -Wimplicit-fallthrough -Wall -Wextra -Werror=implicit-fallthrough -Isrc
CPPFLAGS := -MP -MMD -std=gnu++23 -fwrapv -Wimplicit-fallthrough -Wall -Wextra -Werror=implicit-fallthrough -Isrc
ifeq ($(FPS), 1) # monitor performance -- outputs frametime info via printf
CFLAGS += -DFPSLOG
endif
ifeq ($(AUDMP), 1) # dump raw 2 channel 16 bit pcm audio to audioout.bin
CFLAGS += -DDUMPAUDIO
endif
ifeq ($(THRD), 1) # use threads instead of coroutines -- UNSTABLE - NOT RECOMMENDED
CFLAGS += -DREALTHREAD
endif
ifeq ($(GPUST), 1) # disable multithreaded ppus and gpu for testing purposes -- also disables per-pixel ppu & gpu emulation and vram timings
CFLAGS += -DSINGLETHREADRASTER
endif
ifeq ($(GENPGO), 1) # generate pgo data
CFLAGS += -fprofile-generate=prof
endif
ifeq ($(USEPGO), 1) # use converted pgo data
CFLAGS += -fprofile-use=prof
endif
ifeq ($(NOLOG), 1) # disable misc logging prints, purposeful crash prints and FPS prints still occur
CFLAGS += -DNOLOGGING
endif
ifeq ($(DIRBOOT), 1) # boot rom file directly, requires unencrypted rom
CFLAGS += -DUSEDIRECTBOOT
endif
ifeq ($(USEGCC), 1) # compile with gcc, strongly recommended against, gcc hates my codebase and it runs really slowly
CC := gcc
CXX := g++
endif
ifeq ($(DEB), 1) # debug build
BUILDDIR := $(DEBDIR)
CFLAGS += -march=x86-64-v3 -g -Og
CPPFLAGS += -march=x86-64-v3 -g -Og
else
ifeq ($(SAN), 1) # debug w/ sanitizers
BUILDDIR := $(SANDIR)
CFLAGS += -march=x86-64-v3 -g -Og -fsanitize=undefined -fsanitize=address
CPPFLAGS += -march=x86-64-v3 -g -Og -fsanitize=undefined -fsanitize=address
else
ifeq ($(REL), 1) # release build
BUILDDIR := $(RELDIR)
CFLAGS += -march=x86-64-v3 -O3 -flto=auto
CPPFLAGS += -march=x86-64-v3 -O3 -flto=auto
else # standard build
BUILDDIR := $(MISCDIR)
CFLAGS += -mtune=native -O3 -flto=auto -g
# dont use lto for cppflags to keep the build times half-sane
CPPFLAGS += -mtune=native -O3 -g
endif
endif
endif
OBJS := $(shell find $(SRCDIR) -name '*.c')
OBJS += libs/libco/libco.c
OBJS += $(shell find libs/imgui -maxdepth 1 -name '*.cpp')
OBJS := $(OBJS:%=$(BUILDDIR)$(OBJDIR)/%.o)
DEPS := $(OBJS:.o=.d)
$(BUILDDIR)$(OBJDIR)/%.c.o: %.c
@mkdir -p $(dir $@)
@echo $<
@$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)$(OBJDIR)/%.cpp.o: %.cpp
@mkdir -p $(dir $@)
@echo $<
@$(CXX) $(CPPFLAGS) -c $< -o $@
$(BUILDDIR)/DualSOUP: $(OBJS)
@echo linking...
@$(CXX) $(CPPFLAGS) $(CFLAGS) $^ -o $@ -L$(LIBDIRS) $(LIBS)
.PHONY: clean
clean:
@rm -rf build
-include $(DEPS)