-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (30 loc) · 865 Bytes
/
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
CC = gcc
CFLAGS = -c -Wall -g -std=gnu99 -I/usr/local/include -I./src
LDFLAGS = -g -L/usr/local/lib
SRCDIR = src
OBJDIR = build
SOURCES := $(wildcard $(SRCDIR)/*.c)
OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
#LIBS=-lGL -lGLEW -lSDL2 -lz
#LIBS=-lGLEW -lSDL2 -lz -framework OpenGL $on macOS
LIBS=-lglu32 -lglfw3 -lglew32 -lSDL2 -lz -lopengl32 -lpng
#LDLIBS=
EXECUTABLE=mm6_parse.x
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS)
$(OBJDIR)/%.o : $(SRCDIR)/%.c | makedirs
@echo
@echo "--compiling"
$(CC) $(CFLAGS) -c $< -o $@
# `|` is order-only-prerequisites
# https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
makedirs:
mkdir -p $(OBJDIR)
.PHONY: clean
clean:
@echo
@echo "--cleaning up"
@echo
rm -rf $(OBJDIR)
rm -f $(EXECUTABLE)