2017-07-02 15:18:59 +00:00
|
|
|
# Sources
|
2017-08-05 13:09:50 +00:00
|
|
|
SRC_DIR = source source/libpolarssl/source
|
2017-07-02 15:18:59 +00:00
|
|
|
OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c)))
|
|
|
|
|
2017-08-05 13:09:50 +00:00
|
|
|
# External dependencies
|
|
|
|
DEPENDS = fnd
|
|
|
|
LIB_DIR = ..
|
|
|
|
INCS = -I"include" -I"source/libpolarssl/include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")
|
|
|
|
|
2017-07-02 15:18:59 +00:00
|
|
|
|
|
|
|
# Compiler Settings
|
2018-03-17 07:59:38 +00:00
|
|
|
CXXFLAGS = -std=c++11 $(INCS) -D__STDC_FORMAT_MACROS -Wall -Wno-unused-value
|
|
|
|
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
|
|
|
|
CFLAGS += -Wunused-private-field
|
|
|
|
CXXFLAGS += -Wunused-private-field
|
|
|
|
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-03-17 07:59:38 +00:00
|
|
|
ar $(ARFLAGS) $(OUTPUT) $(OBJS)
|
2017-07-02 15:18:59 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OUTPUT) $(OBJS)
|