A lot of makefile tweaks

This commit is contained in:
Timothy Warren 2015-04-22 21:06:35 -04:00
parent a6c99dfba1
commit 57cafd1fe1
7 changed files with 44 additions and 35 deletions

View File

@ -1,14 +1,8 @@
#Try using clang, if it's installed
ifneq (`command -v clang`,)
CC = clang
CXX = clang++
endif
CXX += -I include
CXX += -Iinclude
SOURCES = $(wildcard include/**/*.cpp src/network/*.cpp src/settings/*.cpp include/*.cpp)
SOURCES = $(wildcard include/**/*.cpp include/*.cpp src/settings/*.cpp)
OBJECTS = $(patsubst %.cpp,%.o, $(SOURCES))
TARGET = build/Tyro.a
TYRO_LIB = build/Tyro.a
JSON_FILES = $(patsubst config/%.json,%.json, $(wildcard config/*.json))
@ -16,12 +10,10 @@ PROGRAM_SRC = $(wildcard src/*.cpp src/widgets/*.cpp)
PROGRAM = build/Tyro
PROGRAM_OBJECTS = $(patsubst %.cpp,%.o, $(PROGRAM_SRC))
WX_LDLIBS = $(shell wx-config --libs base core aui stc adv) -lssh2
WX_LDLIBS = $(shell wx-config --libs base core aui stc adv)
WX_CXXFLAGS = $(shell wx-config --cxxflags)
WX_RES = $(shell wx-config --rescomp)
LDLIBS = $(TARGET)
DEV_CXXFLAGS = -g -Wall -Wextra -DDEBUG
CXXFLAGS = -Os -DNDEBUG
@ -30,17 +22,22 @@ TESTS = $(patsubst %.cpp,%,$(TEST_SRC))
OS ?= $(shell uname -s)
LDLIBS =
ifeq ($(OS),Darwin)
CXX += -std=c++98 -mmacosx-version-min=10.5
else
endif
ifeq ($(OS),Linux)
CXX += -std=c++11
endif
ifeq ($(OS),Windows_NT)
LDLIBS += -L/lib
CXX += -I/include -DWIN32
LDLIBS += -L/lib -lwsock32
endif
all: build json_wrapper $(TARGET) $(PROGRAM)
LDLIBS += -lssh2
all: build json_wrapper $(TYRO_LIB) $(PROGRAM)
dev: CXXFLAGS= $(DEV_CXXFLAGS)
dev: all
@ -54,14 +51,19 @@ json_wrapper_build:
build:
@mkdir -p build
$(TARGET): $(OBJECTS)
sftp_o:
$(CXX) $(CXXFLAGS) $(LDLIBS) -c -o src/network/SFTP.o src/network/SFTP.cpp
$(TYRO_LIB): build sftp_o
$(TYRO_LIB): OBJECTS += src/network/SFTP.o
$(TYRO_LIB): $(OBJECTS)
ar rcs $@ $(OBJECTS)
ranlib $@
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS) $(TARGET)
$(PROGRAM): CXXFLAGS += $(WX_CXXFLAGS) $(TYRO_LIB)
$(PROGRAM):
$(CXX) $(WX_CXXFLAGS) $(PROGRAM_SRC) $(LDLIBS) $(WX_LDLIBS) -o $(PROGRAM)
$(CXX) $(CXXFLAGS) $(PROGRAM_SRC) $(TYRO_LIB) $(WX_LDLIBS) -o $(PROGRAM)
run:
@ -91,7 +93,7 @@ exe: msw_resource all
# OS X application bundle
Tyro.app: all resources/platform/osx/Info.plist
SetFile -t APPL $(TARGET)
SetFile -t APPL $(TYRO_LIB)
-mkdir Tyro.app
-mkdir Tyro.app/Contents
-mkdir Tyro.app/Contents/MacOS
@ -102,8 +104,10 @@ Tyro.app: all resources/platform/osx/Info.plist
cp build/Tyro Tyro.app/Contents/MacOS/Tyro
cp resources/platform/osx/tyro.icns Tyro.app/Contents/Resources/
$(TESTS): $(TYRO_LIB)
$(foreach var, $(TEST_SRC), $(CXX) $(CXXFLAGS) $(var) $(TYRO_LIB) -o $(patsubst %.cpp,%, $(var));)
.PHONY: tests
tests: LDLIBS = $(TARGET) -lssh2
tests: $(TESTS)
sh ./tests/runtests.sh
@ -114,6 +118,6 @@ clean:
rm -f config/*_json.h
rm -rf *.o
rm -rf Tyro.app
rm -rf build $(OBJECTS) $(PROGRAM) $(TARGET) $(TESTS)
rm -rf build $(OBJECTS) $(PROGRAM) $(TYRO_LIB) $(TESTS)
find . -name "*.gc*" -exec rm {} \;
rm -rf `find . -name "*.dSYM" -print`

View File

@ -23,12 +23,12 @@
},
"foreground": {
"default": [101, 123, 131],
"keyword1": [133, 153, 0],
"keyword2": [42, 161, 152],
"keyword1": [220, 50, 47],
"keyword2": [203, 75, 22],
"keyword3": [181, 137, 0],
"keyword4": [181, 137, 0],
"keyword5": [181, 137, 0],
"keyword6": [181, 137, 0],
"keyword4": [133, 153, 0],
"keyword5": [42, 161, 152],
"keyword6": [38, 139, 210],
"comment": [147, 161, 161],
"comment_line": [147, 161, 161],
"comment_doc": [131, 148, 150],
@ -55,6 +55,7 @@
"error": [220, 50, 47]
},
"bold": {
"keyword1": true,
"keyword2": true,
"operator": true,
"label": true,

View File

@ -73,7 +73,7 @@ license you like.
#include "json/json.h"
#include <json/json.h>
#ifndef JSON_IS_AMALGAMATION
#error "Compile with -I PATH_TO_JSON_DIRECTORY"

View File

@ -4,6 +4,7 @@
#ifndef TYRO_COMMON_H
#define TYRO_COMMON_H
// C++ Standard Lib includes
#include <iostream>
#include <iomanip>
#include <fstream>
@ -14,5 +15,12 @@
using namespace std;
// JSON
#include <json/json.h>
typedef Json::Value JsonValue;
typedef Json::Reader JsonReader;
typedef Json::Writer JsonWriter;
#endif // TYRO_COMMON_H

View File

@ -15,6 +15,7 @@
#ifdef WIN32
// Define this so I actually get functions out of the windows header file
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#include <Ws2tcpip.h>
#else

View File

@ -2,11 +2,6 @@
#define TYRO_CONFIG_H
#include "../common.h"
#include <json/json.h>
typedef Json::Value JsonValue;
typedef Json::Reader JsonReader;
typedef Json::Writer JsonWriter;
class TyroConfig {
public:

View File

@ -134,7 +134,7 @@ void EditPane::ApplyTheme(string lang, string theme)
JsonValue keywords_array = this->GetKeywordList(lang);
if (keywords_array.isArray())
{
for(int i = 0; i < keywords_array.size(); i++)
for(unsigned int i = 0; i < keywords_array.size(); i++)
{
this->SetKeyWords(i, keywords_array[i].asString());
}