-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (39 loc) · 1.27 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=gcc
CFLAGS=-ansi -O3 -Wall -Wextra -Wpedantic -Wparentheses \
-Wformat=2 -Wno-unused-parameter -Wshadow \
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition \
-Wredundant-decls -Wnested-externs -Wmissing-include-dirs \
-pedantic-errors -Wuninitialized \
-Wmissing-declarations -Wconversion -Wdouble-promotion \
-Wfloat-equal -Wbad-function-cast -Wno-unknown-pragmas -Wno-unused-function \
# GCC warnings that Clang doesn't provide:
ifeq ($(CC),gcc)
CFLAGS += -Wjump-misses-init -Wlogical-op
endif
PATH:=$(PATH);C:\MinGW\MinGW\bin
ROOT="$(realpath .)"
ODIR=obj
BDIR=bin
SDIR=src
IDIR=-Iinclude -IGL/include
ASSETS_DIR=assets
TARGET=main.exe
LDLIBS=-L$(ROOT)/GL/lib
LIBS=-lopengl32 -lglu32 -lglut32 -lglui32 -lglaux -lwinmm
SRC=$(wildcard $(SDIR)/*.c)
OBJ=$(patsubst $(SDIR)/%.c,$(ODIR)/%.o,$(SRC))
BIN=$(addprefix $(BDIR)/,$(TARGET))
LIB=$(addprefix $(LDLIBS)/,$(LIBS))
.PRECIOUS: %.o
$(ODIR)/%.o: $(SDIR)/%.c
$(CC) -c $< $(CFLAGS) $(IDIR) -o $@
.PHONY:Debug
Debug: $(OBJ)
$(CC) $^ $(CFLAGS) -o $(BIN) -lgdi32 $(LDLIBS) $(LIBS)
dir /b "$(ASSETS_DIR)" | findstr "^" >nul && (copy $(ASSETS_DIR)\* $(BDIR)\$(ASSETS_DIR)\ /Y) || (echo no assets yet)
.PHONY: run
run:
$(BIN)
.PHONY: clean
clean:
del $(ODIR) $(BDIR)\$(TARGET) $(BDIR)\$(ASSETS_DIR)