Tyro/Makefile

89 lines
2.2 KiB
Makefile
Raw Normal View History

2015-04-14 12:53:58 -04:00
CXX = $(shell wx-config --cxx) -I/include
2015-04-14 12:53:58 -04:00
SOURCES = $(wildcard include/**/*.cpp src/network/*.cpp src/settings/*.cpp include/*.cpp)
OBJECTS = $(patsubst %.cpp,%.o, $(SOURCES))
TARGET = build/Tyro.a
JSON_FILES = $(patsubst config/%.json,%.json, $(wildcard config/*.json))
PROGRAM_SRC = $(wildcard src/*.cpp src/widgets/*.cpp)
PROGRAM = build/Tyro
PROGRAM_OBJECTS = $(patsubst %.cpp,%.o, $(PROGRAM_SRC))
2015-04-14 13:49:06 -04:00
BASE_FLAGS = -DSCI_LEXER
2015-04-16 13:16:36 -04:00
LDLIBS = $(TARGET) $(shell wx-config --libs base core aui stc adv) -lssh2
WX_CXXFLAGS = $(shell wx-config --cxxflags) $(BASE_FLAGS)
DEV_CXXFLAGS = -g -Wall -Wextra
CXXFLAGS = -Os
2015-04-16 13:16:36 -04:00
TEST_SRC = $(wildcard tests/*.cpp)
TESTS = $(patsubst %.cpp,%,$(TEST_SRC))
2015-04-16 13:16:36 -04:00
UNAME = $(shell uname -s)
# Add the /lib search directory for MSyS on Windows
ifdef OS
ifeq($(OS),Windows_NT)
LDLIBS += -L/lib
endif
all: build json_wrapper $(TARGET) $(PROGRAM)
dev: CXXFLAGS= $(DEV_CXXFLAGS)
dev: all
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
build:
@mkdir -p build
2015-04-14 13:49:06 -04:00
#$(TARGET): CXXFLAGS +=
$(TARGET): $(OBJECTS)
ar rcs $@ $(OBJECTS)
ranlib $@
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS) $(TARGET)
2015-04-07 20:19:05 -04:00
$(PROGRAM):
$(CXX) $(WX_CXXFLAGS) $(PROGRAM_SRC) $(LDLIBS) -o $(PROGRAM)
run:
./build/Tyro
2015-04-16 13:16:36 -04:00
release: all
ifeq ($(UNAME),Darwin)
make Tyro.app
endif
2015-04-07 10:59:08 -04:00
Tyro.app: all resources/platform/osx/Info.plist
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/
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/
.PHONY: tests
tests: LDLIBS = $(TARGET) -lssh2
tests: $(TESTS)
sh ./tests/runtests.sh
clean:
2015-04-15 09:56:00 -04:00
rm -f config/json2c
rm -f config/*_json.h
rm -f *.o
rm -rf Tyro.app
rm -rf build $(OBJECTS) $(PROGRAM) $(TARGET) $(TESTS)
find . -name "*.gc*" -exec rm {} \;
rm -rf `find . -name "*.dSYM" -print`