-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.linux
41 lines (29 loc) · 1018 Bytes
/
Makefile.linux
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
.PHONY: all
CC = g++
SDL_CONFIG = sdl-config
SDL_INCLUDES = $(shell $(SDL_CONFIG) --cflags)
SDL_LIBS = $(shell $(SDL_CONFIG) --libs)
CCFLAGS = -std=c++11 -Wall $(SDL_INCLUDES)
LDFLAGS += $(SDL_LIBS) -lSDL_image -lGL
all opt debug:
opt: CCFLAGS += -O3 -ffast-math
debug: CCFLAGS += -g
VPATH = src
#SOURCES:= $(wildcard *.cpp)
#BINARIES:= $(foreach source, $(SOURCES), $(source:%.cpp=%.o) )
BINDIR := obj
BASESRC := src
SOURCE := $(BASESRC) $(BASESRC)/blarrg $(BASESRC)/blarrg/gb_apu $(BASESRC)/ui
SOURCES := $(patsubst $(BASESRC)/%, %, $(foreach dir, $(SOURCE), $(wildcard $(dir)/*.cpp)))
BINARIES := $(patsubst %.cpp, %.o, $(SOURCES))
EXECUTABLE := geekboy
all opt debug: $(EXECUTABLE)
$(EXECUTABLE): $(addprefix $(BINDIR)/, $(BINARIES))
$(CC) $(CCFLAGS) $^ -o $@ $(LDFLAGS)
#$(LD) $(LDFLAGS) main.o -o $@ $(LIBS)
clean:
rm -f $(EXECUTABLE)
rm -rf $(BINDIR)
$(BINDIR)/%.o : $(BASESRC)/%.cpp
@test -d $(@D) || mkdir -p $(@D)
$(CC) -DMAKE -c $(CCFLAGS) $< -o $@