#
|
|
# **************************************************************
|
|
# * Simple C++ Makefile Template *
|
|
# * *
|
|
# * Author: Arash Partow (2003) *
|
|
# * URL: http://www.partow.net/programming/makefile/index.html *
|
|
# * *
|
|
# * Copyright notice: *
|
|
# * Free use of this C++ Makefile template is permitted under *
|
|
# * the guidelines and in accordance with the the MIT License *
|
|
# * http://www.opensource.org/licenses/MIT *
|
|
# * *
|
|
# **************************************************************
|
|
#
|
|
#
|
|
# Modifications of the original file are licenced under MIT Licence
|
|
#
|
|
#(c) Ludovic 'Archivist' Lagouardette 2018
|
|
#
|
|
|
|
|
|
CXX := -clang++
|
|
|
|
DEBUG := -g -O0 -DUNITTEST
|
|
RELEASE := -s -O3 -fno-rtti
|
|
|
|
CXXFLAGS := $(RELEASE) -Wno-unknown-warning-option -Wno-address-of-packed-member -pedantic-errors -Wall -Wextra -Werror -Wfatal-errors -std=c++2a -m64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fmodules-ts
|
|
LDFLAGS := -L/usr/lib
|
|
BUILD := build
|
|
OBJ_DIR := $(BUILD)/objects
|
|
MOD_DIR := $(BUILD)/modules
|
|
APP_DIR := $(BUILD)/apps
|
|
TARGET := izaro-storage.cpp
|
|
INCLUDE := -Iinclude/ -I../CommandEr/src -I../json/single_include -I../tiny-js/
|
|
SRC := \
|
|
|
|
MODULES := $(wildcard modules/*.cpp)
|
|
CMODULES := $(MODULES:%.cpp=$(MOD_DIR)/%.pcm)
|
|
OMODULES := $(MODULES:%.cpp=$(MOD_DIR)/%.o)
|
|
|
|
TJS_SRC :=
|
|
#pool_allocator.cpp TinyJS.cpp TinyJS_Functions.cpp TinyJS_MathFunctions.cpp TinyJS_StringFunctions.cpp TinyJS_Threading.cpp
|
|
TJS_OBJECTS := $(TJS_SRC:%.cpp=$(OBJ_DIR)/%.tjs.o)
|
|
|
|
OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.o) ../CommandEr/build/commander.o
|
|
TEST_OBJECTS := $(SRC:%.cpp=$(OBJ_DIR)/%.test.o)
|
|
TARGETNAME := $(TARGET:%.cpp=%)
|
|
|
|
all: build $(TARGET)
|
|
|
|
$(MOD_DIR)/%.o: %.cpp
|
|
@mkdir -p $(@D)
|
|
$(CXX) $(CXXFLAGS) -fmodules-ts --precompile $< -o $(OMODULES:$(MOD_DIR)/%.o=$(MOD_DIR)/%.pcm)
|
|
$(CXX) $(CXXFLAGS) -fmodules-ts -c $(OMODULES:$(MOD_DIR)/%.o=$(MOD_DIR)/%.pcm) -o $@
|
|
|
|
$(TARGET): $(OBJECTS) build
|
|
make -C ../CommandEr
|
|
@mkdir -p $(@D)
|
|
$(CXX) $(CXXFLAGS) -pthread $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGETNAME) src/$(TARGET) $(OBJECTS) $(TJS_OBJECTS)
|
|
|
|
.PHONY: all build clean
|
|
|
|
ASTYLE_FLAGS= --style=stroustrup --align-reference=type --align-pointer=type --break-blocks \
|
|
--indent-namespaces --indent=tab --add-brackets
|
|
format:
|
|
astyle $(ASTYLE_FLAGS) include/*
|
|
astyle $(ASTYLE_FLAGS) src/*
|
|
|
|
build:
|
|
@mkdir -p $(APP_DIR)
|
|
@mkdir -p $(OBJ_DIR)
|
|
|
|
clean:
|
|
rm -rf build/*
|
|
rm -rf src/*.orig
|
|
rm -rf include/*.orig
|