#
|
|
# **************************************************************
|
|
# * 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++17 -m64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
|
|
LDFLAGS := -L/usr/lib
|
|
BUILD := build
|
|
OBJ_DIR := $(BUILD)/objects
|
|
APP_DIR := $(BUILD)/apps
|
|
TARGET := izaro-storage.cpp
|
|
INCLUDE := -Iinclude/ -I./CommandEr/src -I./json/single_include -Itiny-js/
|
|
SRC := \
|
|
|
|
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)
|
|
|
|
$(OBJ_DIR)/%.tjs.o: tiny-js/%.cpp
|
|
@mkdir -p $(@D)
|
|
$(CXX) $(CXXFLAGS) -fpermissive -w -Wno-pedantic $(INCLUDE) -o $@ -c $<
|
|
|
|
$(OBJ_DIR)/%.test.o: %.cpp
|
|
@mkdir -p $(@D)
|
|
$(CXX) $(CXXFLAGS) -DUSE_CATCH $(INCLUDE) -o $@ -c $<
|
|
|
|
$(OBJ_DIR)/%.o: %.cpp
|
|
@mkdir -p $(@D)
|
|
$(CXX) $(CXXFLAGS) $(INCLUDE) -o $@ -c $<
|
|
|
|
$(TARGET): $(OBJECTS) $(TJS_OBJECTS) build
|
|
make -C CommandEr
|
|
@mkdir -p $(@D)
|
|
$(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/$(TARGETNAME) src/$(TARGET) $(OBJECTS) $(TJS_OBJECTS)
|
|
$(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/test_client src/test_client.cpp
|
|
$(CXX) $(CXXFLAGS) $(INCLUDE) $(LDFLAGS) -o $(APP_DIR)/db_stats src/db_stats.cpp
|
|
|
|
.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
|