-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (43 loc) · 1.03 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
CC=g++
SRC_DIR=src
BIN_DIR=bin
OBJ_DIR=obj
INC_DIR=include
SDL_CONFIG=sdl2-config
SRC=$(wildcard $(SRC_DIR)/*.cpp)
OBJS=$(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC))
OUT=texel
CFLAGS=$(shell $(SDL_CONFIG) --cflags) -std=c++20
INC=-I$(INC_DIR)/
LIBS=$(shell $(SDL_CONFIG) --libs) -lGLEW
EXTRA_ARGS=
ifeq ($(OS), Windows_NT)
DEBUG=-g
CC=x86_64-w64-mingw32-gcc
SDL_CONFIG=$(shell echo $$WINDOWS_SDL_CONFIG_LOCATION)
CFLAGS += --std=c99
else
OS=$(shell uname)
DEBUG=-ggdb
INC += -I/usr/local/include
ifeq ($(OS), Darwin)
INC += -I/opt/homebrew/include
EXTRA_ARGS+=-framework OpenGL
else
INC += -I/usr/local/include
LIBS+=-lGL
endif
endif
debug: CFLAGS += $(DEBUG)
debug: CFLAGS += -DDEBUG_TEST
all: $(OBJS)
$(CC) $^ $(CFLAGS) $(LIBS) -o $(addprefix $(BIN_DIR)/,$(OUT)) $(EXTRA_ARGS)
$(OBJ_DIR)/%.o : $(SRC_DIR)/%.cpp
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
debug: $(OBJS)
$(CC) $^ $(CFLAGS) $(LIBS) -o $(addprefix $(BIN_DIR)/,$(OUT)_debug)
install:
cp ./bin/shdr /usr/local/bin
clean:
rm -rf $(BIN_DIR)/*
rm -f $(OBJ_DIR)/*.o