forked from bullno1/cosmo-sokol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (55 loc) · 1.74 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
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
COSMOS := /opt/cosmos
CC = $(COSMOS)/bin/cosmocc
CXX = $(COSMOS)/bin/cosmoc++
CPPFLAGS := -I deps/sokol -I deps/cimgui -MMD -MP
CFLAGS := -mcosmo -g -ggdb -Wall -O2
CXXFLAGS := $(CFLAGS)
LINUX_CPPFLAGS := -Ishims/linux
WIN32_CPPFLAGS := -Ishims/win32 -I$(COSMOS)/include/libc/nt
BUILD_DIR := .build
BIN_DIR := bin
.PHONY: all clean
all: bin/cosmo-sokol
SRCS := \
shims/sokol/sokol_windows.c \
shims/sokol/sokol_linux.c \
shims/sokol/sokol_shared.c \
shims/sokol/sokol_cosmo.c \
SRCS += \
deps/cimgui/cimgui.cpp \
deps/cimgui/imgui/imgui.cpp \
deps/cimgui/imgui/imgui_demo.cpp \
deps/cimgui/imgui/imgui_draw.cpp \
deps/cimgui/imgui/imgui_tables.cpp \
deps/cimgui/imgui/imgui_widgets.cpp \
SRCS += \
shims/linux/gl.c \
shims/linux/x11.c
SRCS += \
nvapi/nvapi.c \
win32_tweaks.c
SRCS += main.c
OBJS := $(patsubst %.c,$(BUILD_DIR)/%.o,$(patsubst %.cpp,$(BUILD_DIR)/%.o,$(SRCS)))
DEPS := $(OBJS:.o=.d)
$(BUILD_DIR)/%.o: %.c
mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.o: %.cpp
mkdir -p $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
$(BUILD_DIR)/shims/sokol/sokol_windows.o: CPPFLAGS += $(WIN32_CPPFLAGS)
$(BUILD_DIR)/shims/sokol/sokol_linux.o: CPPFLAGS += $(LINUX_CPPFLAGS)
$(BUILD_DIR)/shims/linux/%.o: CPPFLAGS += $(LINUX_CPPFLAGS)
$(BUILD_DIR)/nvapi/%.o: CPPFLAGS += $(WIN32_CPPFLAGS)
$(BUILD_DIR)/win32_%.o: CPPFLAGS += $(WIN32_CPPFLAGS)
$(BUILD_DIR)/main.o: CPPFLAGS += -Invapi
$(BUILD_DIR)/shims/linux/gl.c: shims/linux/gen-gl
cd shims/linux && ./gen-gl
$(BUILD_DIR)/shims/linux/x11.c: shims/linux/gen-x11
cd shims/linux && ./gen-x11
$(BIN_DIR)/cosmo-sokol: $(OBJS)
mkdir -p $(dir $@)
$(CXX) $(OBJS) -o $@ $(LDFLAGS)
clean:
rm -rf $(BUILD_DIR) $(BIN_DIR)
-include $(DEPS)