2017-07-02 15:18:59 +00:00
|
|
|
# Sources
|
2017-08-05 13:09:50 +00:00
|
|
|
SRC_DIR = source
|
2018-08-07 06:33:39 +00:00
|
|
|
OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
2017-07-02 15:18:59 +00:00
|
|
|
|
2017-08-05 13:09:50 +00:00
|
|
|
# External dependencies
|
2018-08-07 06:33:39 +00:00
|
|
|
DEPENDS =
|
|
|
|
LIB_DIR = ..
|
|
|
|
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
2017-07-02 15:18:59 +00:00
|
|
|
|
|
|
|
# Compiler Settings
|
2018-08-07 06:33:39 +00:00
|
|
|
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value
|
2018-03-17 07:59:38 +00:00
|
|
|
CFLAGS = -std=c11 $(INCS) -Wall -Wno-unused-value
|
|
|
|
ARFLAGS = cr -o
|
2017-07-02 15:18:59 +00:00
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
# Windows Only Flags/Libs
|
|
|
|
CC = x86_64-w64-mingw32-gcc
|
|
|
|
CXX = x86_64-w64-mingw32-g++
|
2018-03-17 07:59:38 +00:00
|
|
|
CFLAGS += -Wno-unused-but-set-variable
|
|
|
|
CXXFLAGS += -Wno-unused-but-set-variable
|
2017-07-02 15:18:59 +00:00
|
|
|
else
|
2018-03-17 07:59:38 +00:00
|
|
|
UNAME = $(shell uname -s)
|
|
|
|
ifeq ($(UNAME), Darwin)
|
|
|
|
# MacOS Only Flags/Libs
|
2018-08-07 05:28:06 +00:00
|
|
|
CFLAGS += -arch x86_64 -Wno-unused-private-field
|
|
|
|
CXXFLAGS += -arch x86_64 -Wno-unused-private-field
|
2018-03-17 07:59:38 +00:00
|
|
|
ARFLAGS = rc
|
|
|
|
else
|
|
|
|
# *nix Only Flags/Libs
|
|
|
|
CFLAGS += -Wno-unused-but-set-variable
|
|
|
|
CXXFLAGS += -Wno-unused-but-set-variable
|
|
|
|
endif
|
2017-07-02 15:18:59 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Output
|
2017-08-05 13:09:50 +00:00
|
|
|
OUTPUT = $(shell basename $(CURDIR)).a
|
2017-07-02 15:18:59 +00:00
|
|
|
|
|
|
|
main: build
|
|
|
|
|
|
|
|
rebuild: clean build
|
|
|
|
|
|
|
|
build: $(OBJS)
|
2018-08-07 07:17:51 +00:00
|
|
|
ar $(ARFLAGS) $(OUTPUT) $(OBJS)
|
2017-07-02 15:18:59 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OUTPUT) $(OBJS)
|