[go: up one dir, main page]

Menu

[d9b99a]: / Makefile  Maximize  Restore  History

Download this file

44 lines (32 with data), 864 Bytes

 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
#Output directories
SRC_DIR := src
OBJ_DIR := obj
BIN_DIR := bin
#TARGET
TARGET := $(BIN_DIR)/psx-comBINe
#Source files
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
#Objects derived from Sources
OBJS := $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRCS))
#Compiler
CC := g++
#Flags
CPPFLAGS := -Iinclude -MMD -MP #NOTE. Include path is to /usr/include. this may be arch specific
CFLAGS := -Wall
LDFLAGS := -Llib -lboost_system -lboost_filesystem
LDLIBS := -lm
.PHONY: all clean
all: $(TARGET)
#Make binary
$(TARGET): $(OBJS) | $(BIN_DIR)
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
#Make objects
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
#Create obj and bin directory if they don't exist
$(BIN_DIR) $(OBJ_DIR):
mkdir -p $@
#Remove objects and binary
clean:
@$(RM) -rv $(BIN_DIR) $(OBJ_DIR)
-include $(OBJ:.o=.d)