2015-04-21 21:41:56 -04:00
|
|
|
#Try using clang, if it's installed
|
|
|
|
ifneq ($(shell which clang),clang not found)
|
|
|
|
CXX = $(patsubst g++,clang++, $(shell wx-config --cxx)) -std=c++11 -I/include
|
|
|
|
else
|
|
|
|
CXX = $(shell wx-config --cxx) -I/include
|
|
|
|
endif
|
2015-04-07 17:08:28 -04:00
|
|
|
|
2015-04-14 12:53:58 -04:00
|
|
|
SOURCES = $(wildcard include/**/*.cpp src/network/*.cpp src/settings/*.cpp include/*.cpp)
|
2015-03-31 16:43:42 -04:00
|
|
|
OBJECTS = $(patsubst %.cpp,%.o, $(SOURCES))
|
2015-04-07 17:08:28 -04:00
|
|
|
TARGET = build/Tyro.a
|
|
|
|
|
2015-04-15 09:47:20 -04:00
|
|
|
JSON_FILES = $(patsubst config/%.json,%.json, $(wildcard config/*.json))
|
|
|
|
|
2015-04-07 17:08:28 -04:00
|
|
|
PROGRAM_SRC = $(wildcard src/*.cpp src/widgets/*.cpp)
|
|
|
|
PROGRAM = build/Tyro
|
2015-04-16 22:07:51 -04:00
|
|
|
PROGRAM_OBJECTS = $(patsubst %.cpp,%.o, $(PROGRAM_SRC))
|
2015-04-07 17:08:28 -04:00
|
|
|
|
2015-04-16 22:07:51 -04:00
|
|
|
WX_LDLIBS = $(shell wx-config --libs base core aui stc adv) -lssh2
|
|
|
|
WX_CXXFLAGS = $(shell wx-config --cxxflags)
|
|
|
|
WX_RES = $(shell wx-config --rescomp)
|
|
|
|
|
|
|
|
LDLIBS = $(TARGET)
|
2015-04-07 17:08:28 -04:00
|
|
|
|
2015-04-17 16:55:48 -04:00
|
|
|
DEV_CXXFLAGS = -g -Wall -Wextra -DDEBUG
|
|
|
|
CXXFLAGS = -Os -DNDEBUG
|
2015-04-16 22:07:51 -04:00
|
|
|
|
2015-04-16 13:16:36 -04:00
|
|
|
TEST_SRC = $(wildcard tests/*.cpp)
|
2015-04-07 17:08:28 -04:00
|
|
|
TESTS = $(patsubst %.cpp,%,$(TEST_SRC))
|
2015-03-31 16:43:42 -04:00
|
|
|
|
2015-04-16 22:07:51 -04:00
|
|
|
OS ?= $(shell uname -s)
|
2015-04-16 13:16:36 -04:00
|
|
|
|
2015-04-16 22:07:51 -04:00
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
LDLIBS += -L/lib
|
|
|
|
endif
|
2015-04-16 13:16:36 -04:00
|
|
|
|
2015-04-15 09:47:20 -04:00
|
|
|
all: build json_wrapper $(TARGET) $(PROGRAM)
|
2015-03-31 16:43:42 -04:00
|
|
|
|
|
|
|
dev: CXXFLAGS= $(DEV_CXXFLAGS)
|
|
|
|
dev: all
|
2015-04-15 09:47:20 -04:00
|
|
|
|
|
|
|
json_wrapper: json_wrapper_build
|
|
|
|
$(foreach var, $(JSON_FILES), config/json2c config/$(var) $(patsubst %.json,config/%_json.h,$(var)) $(patsubst %.json,%_json,$(var));)
|
|
|
|
|
|
|
|
json_wrapper_build:
|
|
|
|
$(CC) config/json2c.c -o config/json2c
|
2015-03-31 16:43:42 -04:00
|
|
|
|
|
|
|
build:
|
|
|
|
@mkdir -p build
|
|
|
|
|
|
|
|
$(TARGET): $(OBJECTS)
|
2015-04-07 17:08:28 -04:00
|
|
|
ar rcs $@ $(OBJECTS)
|
|
|
|
ranlib $@
|
|
|
|
|
|
|
|
|
|
|
|
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS) $(TARGET)
|
2015-04-07 20:19:05 -04:00
|
|
|
$(PROGRAM):
|
2015-04-16 22:07:51 -04:00
|
|
|
$(CXX) $(WX_CXXFLAGS) $(PROGRAM_SRC) $(LDLIBS) $(WX_LDLIBS) -o $(PROGRAM)
|
2015-04-07 17:08:28 -04:00
|
|
|
|
2015-03-31 16:43:42 -04:00
|
|
|
|
|
|
|
run:
|
|
|
|
./build/Tyro
|
|
|
|
|
2015-04-16 22:07:51 -04:00
|
|
|
release:
|
|
|
|
ifeq ($(OS),Darwin)
|
2015-04-16 13:16:36 -04:00
|
|
|
make Tyro.app
|
|
|
|
endif
|
2015-04-16 22:07:51 -04:00
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
make exe
|
|
|
|
endif
|
|
|
|
ifeq ($(OS),Linux)
|
|
|
|
make all
|
|
|
|
endif
|
|
|
|
# strip -sxX $(PROGRAM)
|
|
|
|
|
|
|
|
msw_resource:
|
|
|
|
$(WX_RES) resources/platform/msw/resource.rc -O coff -o resource.res
|
|
|
|
|
|
|
|
exe: LDLIBS += resource.res
|
|
|
|
exe: msw_resource all
|
2015-04-16 13:16:36 -04:00
|
|
|
|
2015-04-07 10:59:08 -04:00
|
|
|
Tyro.app: all resources/platform/osx/Info.plist
|
2015-04-17 12:48:00 -04:00
|
|
|
strip -SXx $(PROGRAM)
|
2015-03-31 16:43:42 -04:00
|
|
|
SetFile -t APPL $(TARGET)
|
|
|
|
-mkdir Tyro.app
|
|
|
|
-mkdir Tyro.app/Contents
|
|
|
|
-mkdir Tyro.app/Contents/MacOS
|
|
|
|
-mkdir Tyro.app/Contents/Resources
|
|
|
|
-mkdir Tyro.app/Contents/Resources/English.lproj
|
2015-04-07 10:59:08 -04:00
|
|
|
cp resources/platform/osx/Info.plist Tyro.app/Contents/
|
2015-03-31 16:43:42 -04:00
|
|
|
echo -n 'APPL????' > Tyro.app/Contents/PkgInfo
|
|
|
|
cp build/Tyro Tyro.app/Contents/MacOS/Tyro
|
2015-04-07 10:59:08 -04:00
|
|
|
cp resources/platform/osx/tyro.icns Tyro.app/Contents/Resources/
|
2015-03-31 16:43:42 -04:00
|
|
|
|
2015-04-07 17:08:28 -04:00
|
|
|
.PHONY: tests
|
|
|
|
tests: LDLIBS = $(TARGET) -lssh2
|
|
|
|
tests: $(TESTS)
|
|
|
|
sh ./tests/runtests.sh
|
|
|
|
|
2015-03-31 16:43:42 -04:00
|
|
|
clean:
|
2015-04-16 22:07:51 -04:00
|
|
|
rm -f *.res
|
2015-04-15 09:56:00 -04:00
|
|
|
rm -f config/json2c
|
2015-04-16 22:07:51 -04:00
|
|
|
rm -f config/json2c.exe
|
2015-04-15 09:56:00 -04:00
|
|
|
rm -f config/*_json.h
|
2015-04-16 22:07:51 -04:00
|
|
|
rm -rf *.o
|
2015-03-31 16:43:42 -04:00
|
|
|
rm -rf Tyro.app
|
2015-04-07 17:08:28 -04:00
|
|
|
rm -rf build $(OBJECTS) $(PROGRAM) $(TARGET) $(TESTS)
|
2015-03-31 16:43:42 -04:00
|
|
|
find . -name "*.gc*" -exec rm {} \;
|
|
|
|
rm -rf `find . -name "*.dSYM" -print`
|