-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (27 loc) · 854 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
CXX := -g++
CXXFLAGS := -pedantic-errors -Wall -g -std=c++11 -fpermissive -Wno-sign-compare -Wno-switch
LDFLAGS := -L/usr/lib -lstdc++ -lm `sdl2-config --libs`
BUILD := ./build
OBJ_DIR := $(BUILD)/objects
APP_DIR := $(BUILD)/
TARGET := SGBE
INCLUDE := -I /usr/include/SDL2
SRC := \
$(wildcard src/common/*.cpp) \
$(wildcard src/gb/cartridge/*.cpp) \
$(wildcard src/gb/*.cpp) \
$(wildcard src/sgbe_app/*.cpp) \
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o)
all: build $(APP_DIR)/$(TARGET)
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@ $(LDFLAGS)
$(APP_DIR)/$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -o $(APP_DIR)/$(TARGET) $^ $(LDFLAGS)
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
clean:
-@rm -rvf $(OBJ_DIR)/*
-@rm -rvf $(APP_DIR)/$(TARGET)