Update Makefile for static building
This commit is contained in:
parent
c428aa92d5
commit
5950f7d95d
62
Makefile
62
Makefile
@ -1,5 +1,3 @@
|
|||||||
CXX += -I include -I.
|
|
||||||
|
|
||||||
SOURCES = $(wildcard include/**/*.cpp include/*.cpp src/network/*.cpp src/settings/*.cpp)
|
SOURCES = $(wildcard include/**/*.cpp include/*.cpp src/network/*.cpp src/settings/*.cpp)
|
||||||
OBJECTS = $(patsubst %.cpp,%.o, $(SOURCES))
|
OBJECTS = $(patsubst %.cpp,%.o, $(SOURCES))
|
||||||
TYRO_LIB = build/Tyro.a
|
TYRO_LIB = build/Tyro.a
|
||||||
@ -10,33 +8,47 @@ PROGRAM_SRC = $(wildcard src/*.cpp src/widgets/*.cpp)
|
|||||||
PROGRAM = build/Tyro
|
PROGRAM = build/Tyro
|
||||||
PROGRAM_OBJECTS = $(patsubst %.cpp,%.o, $(PROGRAM_SRC))
|
PROGRAM_OBJECTS = $(patsubst %.cpp,%.o, $(PROGRAM_SRC))
|
||||||
|
|
||||||
WX_LDLIBS = $(shell wx-config --libs base core aui stc adv)
|
|
||||||
WX_CXXFLAGS = $(shell wx-config --cxxflags)
|
|
||||||
WX_RES = $(shell wx-config --rescomp)
|
WX_RES = $(shell wx-config --rescomp)
|
||||||
|
|
||||||
DEV_CXXFLAGS = -g -Wall -Wextra -DDEBUG -DSTATIC_BUILD
|
DEV_CXXFLAGS = -g -Wall -Wextra -DDEBUG
|
||||||
CXXFLAGS = -Os -DNDEBUG -DSTATIC_BUILD
|
CXXFLAGS = -Os -DNDEBUG
|
||||||
|
|
||||||
TEST_SRC = $(wildcard tests/*.cpp)
|
TEST_SRC = $(wildcard tests/*.cpp)
|
||||||
TESTS = $(patsubst %.cpp,%,$(TEST_SRC))
|
TESTS = $(patsubst %.cpp,%,$(TEST_SRC))
|
||||||
|
|
||||||
OS ?= $(shell uname -s)
|
|
||||||
|
|
||||||
LDLIBS =
|
LDLIBS =
|
||||||
|
|
||||||
|
OS ?= $(shell uname -s)
|
||||||
|
|
||||||
|
# Get static version of libs to link to on platforms that support it
|
||||||
|
ifneq ($(OS),Linux)
|
||||||
|
WX_CXXFLAGS = $(shell wx-config --static --cxxflags)
|
||||||
|
WX_LDLIBS = $(shell wx-config --static --libs base core aui stc adv)
|
||||||
|
else
|
||||||
|
WX_CXXFLAGS = $(shell wx-config --cxxflags)
|
||||||
|
WX_LDLIBS = $(shell wx-config --libs base core aui stc adv)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
CXX += -std=c++98 -mmacosx-version-min=10.5
|
LDLIBS += /usr/local/lib/libssh2.a
|
||||||
|
else
|
||||||
|
LDLIBS += -lssh2
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Platform compiler flags
|
||||||
|
ifeq ($(OS),Darwin)
|
||||||
|
CXX = clang++ -std=c++98 -mmacosx-version-min=10.5
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS),Linux)
|
ifeq ($(OS),Linux)
|
||||||
CXX += -std=c++11
|
CXX += -std=c++11
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
CXXFLAGS = -DNDEBUG -DSTATIC_BUILD
|
CXXFLAGS = -DNDEBUG -DSTATIC_BUILD -static
|
||||||
CXX += -I/include -DWIN32
|
CXX += -I/include -DWIN32
|
||||||
LDLIBS += -L/lib -lwsock32
|
LDLIBS += -L/lib -lwsock32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LDLIBS += -lssh2
|
CXX += -I include -I.
|
||||||
|
|
||||||
all: build json_wrapper $(TYRO_LIB) $(PROGRAM)
|
all: build json_wrapper $(TYRO_LIB) $(PROGRAM)
|
||||||
|
|
||||||
@ -57,7 +69,7 @@ $(TYRO_LIB): build $(OBJECTS)
|
|||||||
ranlib $@
|
ranlib $@
|
||||||
|
|
||||||
|
|
||||||
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS) $(TYRO_LIB)
|
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS)
|
||||||
$(PROGRAM):
|
$(PROGRAM):
|
||||||
$(CXX) $(CXXFLAGS) $(PROGRAM_SRC) $(TYRO_LIB) $(WX_LDLIBS) $(LDLIBS) -o $(PROGRAM)
|
$(CXX) $(CXXFLAGS) $(PROGRAM_SRC) $(TYRO_LIB) $(WX_LDLIBS) $(LDLIBS) -o $(PROGRAM)
|
||||||
|
|
||||||
@ -73,6 +85,7 @@ run-grind:
|
|||||||
# Make optimized and striped executable
|
# Make optimized and striped executable
|
||||||
release:
|
release:
|
||||||
ifeq ($(OS),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
|
make all
|
||||||
strip -SXx $(PROGRAM)
|
strip -SXx $(PROGRAM)
|
||||||
make Tyro.app
|
make Tyro.app
|
||||||
endif
|
endif
|
||||||
@ -93,18 +106,19 @@ exe: LDLIBS += resource.res
|
|||||||
exe: json_wrapper_build json_wrapper $(TYRO_LIB)
|
exe: json_wrapper_build json_wrapper $(TYRO_LIB)
|
||||||
exe: msw_resource $(PROGRAM)
|
exe: msw_resource $(PROGRAM)
|
||||||
|
|
||||||
# OS X application bundle
|
# OS X application bundle
|
||||||
Tyro.app: all resources/platform/osx/Info.plist
|
Tyro.app: CXXFLAGS += -static
|
||||||
|
Tyro.app: all
|
||||||
SetFile -t APPL $(TYRO_LIB)
|
SetFile -t APPL $(TYRO_LIB)
|
||||||
-mkdir Tyro.app
|
-mkdir -p build/Tyro.app
|
||||||
-mkdir Tyro.app/Contents
|
-mkdir -p build/Tyro.app/Contents
|
||||||
-mkdir Tyro.app/Contents/MacOS
|
-mkdir -p build/Tyro.app/Contents/MacOS
|
||||||
-mkdir Tyro.app/Contents/Resources
|
-mkdir -p build/Tyro.app/Contents/Resources
|
||||||
-mkdir Tyro.app/Contents/Resources/English.lproj
|
-mkdir -p build/Tyro.app/Contents/Resources/English.lproj
|
||||||
cp resources/platform/osx/Info.plist Tyro.app/Contents/
|
cp resources/platform/osx/Info.plist build/Tyro.app/Contents/
|
||||||
echo -n 'APPL????' > Tyro.app/Contents/PkgInfo
|
echo -n 'APPL????' > build/Tyro.app/Contents/PkgInfo
|
||||||
cp build/Tyro Tyro.app/Contents/MacOS/Tyro
|
cp build/Tyro build/Tyro.app/Contents/MacOS/Tyro
|
||||||
cp resources/platform/osx/tyro.icns Tyro.app/Contents/Resources/
|
cp resources/platform/osx/tyro.icns build/Tyro.app/Contents/Resources/
|
||||||
|
|
||||||
$(TESTS): $(TYRO_LIB)
|
$(TESTS): $(TYRO_LIB)
|
||||||
$(foreach var, $(TEST_SRC), $(CXX) $(CXXFLAGS) $(var) $(TYRO_LIB) $(LDLIBS) -o $(patsubst %.cpp,%, $(var));)
|
$(foreach var, $(TEST_SRC), $(CXX) $(CXXFLAGS) $(var) $(TYRO_LIB) $(LDLIBS) -o $(patsubst %.cpp,%, $(var));)
|
||||||
@ -119,7 +133,7 @@ clean:
|
|||||||
rm -f config/json2c.exe
|
rm -f config/json2c.exe
|
||||||
rm -f config/*_json.h
|
rm -f config/*_json.h
|
||||||
rm -rf *.o
|
rm -rf *.o
|
||||||
rm -rf Tyro.app
|
rm -rf build/Tyro.app
|
||||||
rm -rf build $(OBJECTS) $(PROGRAM) $(TYRO_LIB) $(TESTS)
|
rm -rf build $(OBJECTS) $(PROGRAM) $(TYRO_LIB) $(TESTS)
|
||||||
find . -name "*.gc*" -exec rm {} \;
|
find . -name "*.gc*" -exec rm {} \;
|
||||||
rm -rf `find . -name "*.dSYM" -print`
|
rm -rf `find . -name "*.dSYM" -print`
|
||||||
|
@ -8,5 +8,7 @@
|
|||||||
<string>Tyro</string>
|
<string>Tyro</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>tyro.icns</string>
|
<string>tyro.icns</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>net.timshomepage.Tyro</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
Loading…
Reference in New Issue
Block a user