forked from ParadoxZero/GameMenu-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (25 loc) · 898 Bytes
/
Makefile
File metadata and controls
37 lines (25 loc) · 898 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
BUILD = build
BIN = lib
OUTPUTNAME = libGameMenu.a
INCLUDE = -I./include
SRCFILES := $(shell find src/ -name *.cpp)
OBJFILES := $(patsubst %.cpp,%.o,$(SRCFILES))
OBJFILES := $(foreach dir,$(OBJFILES),$(subst src/,,$(dir)))
DIR := $(dir $(OBJFILES))
TARGETLIST = $(foreach f,$(OBJFILES),$(BUILD)/$(f))
$(foreach d,$(DIR),$(shell mkdir -p $(BUILD)/$(d)))
$(shell mkdir -p $(BIN))
CC = g++
CFLAGS = -g -std=c++11
LIBS=
G++_VER_LT48 := $(shell expr `$(CC) -dumpversion | cut -f1-2 -d.` \< 4.8 )
ifeq ("$(G++_VER_LT48)","1")
$(error old version of g++ not supported, upgrade to 4.8 or higher)
endif
$(info Source: $(SRCFILES))
$(info Targets: $(TARGETLIST))
default: $(BIN)/$(OUTPUTNAME)
$(BIN)/$(OUTPUTNAME): $(TARGETLIST)
ar crf $(BIN)/$(OUTPUTNAME) $(TARGETLIST)
$(BUILD)/%.o: $(SRCFILES)
$(CC) -c $(CFLAGS) $(INCLUDE) $(filter %$(notdir $(patsubst %.o,%.cpp,$@)),$(SRCFILES)) -o $@