Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8aa78ad
commit 872297f
Showing
1 changed file
with
40 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,46 @@ | ||
CXX=g++ | ||
CXXFLAGS=-g -std=c++11 -c -Wall -I. -I../../CompilerSource | ||
BINARY := ../../emake | ||
SRC_DIR := . | ||
OBJ_DIR := .eobjs | ||
|
||
ifeq ($(OS),Windows_NT) | ||
LDFLAGS=-lboost_system-mt -Wl,--no-as-needed -Wl,-rpath=./ -lboost_program_options-mt -lboost_iostreams-mt -lboost_filesystem-mt -lboost_system-mt -lpthread | ||
OS_LIBS=-lboost_system-mt -Wl,--no-as-needed -Wl,-rpath=./ -lboost_program_options-mt -lboost_iostreams-mt -lboost_filesystem-mt -lboost_system-mt -lpthread | ||
else | ||
LDFLAGS=-lboost_system -Wl,--no-as-needed -Wl,-rpath=./ -lboost_program_options -lboost_iostreams -lboost_filesystem -lboost_system -lpthread -ldl | ||
OS_LIBS=-lboost_system -Wl,--no-as-needed -Wl,-rpath=./ -lboost_program_options -lboost_iostreams -lboost_filesystem -lboost_system -lpthread -ldl | ||
endif | ||
|
||
SOURCES=$(shell find . -name "*.cpp") | ||
OBJECTS=$(addprefix .eobjs/,$(SOURCES:.cpp=.o)) | ||
EXECUTABLE=../../emake | ||
|
||
all: $(SOURCES) $(EXECUTABLE) | ||
|
||
$(EXECUTABLE): $(OBJECTS) eyaml eventsres | ||
$(CXX) $(OBJECTS) $(LDFLAGS) .eobjs/eyaml.o .eobjs/event_parser.o -o $@ | ||
|
||
.eobjs/%.o : %.cpp .eobjs | ||
$(CXX) $(CXXFLAGS) $< -o $@ | ||
|
||
.PHONY: eyaml, eventsres, clean | ||
|
||
#I'm To lazy to write my own yaml parser or fix plugin to do shit I need | ||
eyaml: | ||
$(CXX) $(CXXFLAGS) ../../CompilerSource/settings-parse/eyaml.cpp -o .eobjs/eyaml.o | ||
eventsres: | ||
$(CXX) $(CXXFLAGS) ../../CompilerSource/compiler/event_reader/event_parser.cpp -o .eobjs/event_parser.o | ||
|
||
.eobjs: | ||
mkdir -p .eobjs/ | ||
|
||
EXTRA_SOURCES := ../../CompilerSource/settings-parse/eyaml.cpp ../../CompilerSource/compiler/event_reader/event_parser.cpp | ||
EXTRA_SRC_DIR := ../../CompilerSource | ||
|
||
CXXFLAGS := -I$(SRC_DIR) -I$(EXTRA_SRC_DIR) `wx-config --cxxflags` -Wall -Wextra -Wpedantic -g | ||
LDFLAGS := $(OS_LIBS) | ||
TEST_LIBS := -lgtest_main | ||
|
||
EXTRA_OBJS := $(patsubst $(EXTRA_SRC_DIR)/%, $(OBJ_DIR)/Extra/%, $(patsubst %.cpp, %.o, $(EXTRA_SOURCES))) | ||
|
||
SOURCES := $(shell find $(SRC_DIR) -name '*.cpp') | ||
OBJECTS := $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(patsubst %.cpp, %.o, $(SOURCES))) | ||
OBJDIRS := $(sort $(OBJ_DIR) $(dir $(OBJECTS)) $(dir $(EXTRA_OBJS))) | ||
DEPENDS := $(OBJECTS:.o=.d) $(EXTRA_OBJS:.o=.d) | ||
|
||
$(BINARY): $(OBJECTS) $(EXTRA_OBJS) | ||
g++ $(LDFLAGS) $^ -o $@ | ||
|
||
.PHONY: all clean | ||
|
||
all: $(BINARY) | ||
clean: | ||
rm -f .eobjs/*.o | ||
rm -f ../../emake | ||
rm -rf $(BINARY) $(OBJ_DIR) | ||
|
||
# Create the object directories | ||
$(OBJDIRS): | ||
mkdir -p $@ | ||
|
||
# Generate rules for new (unbuilt) files | ||
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJDIRS) | ||
$(CXX) $(CXXFLAGS) -MMD -c -o $@ $< | ||
$(OBJ_DIR)/Extra/%.o: $(EXTRA_SRC_DIR)/%.cpp | $(OBJDIRS) | ||
$(CXX) $(CXXFLAGS) -MMD -c -o $@ $< | ||
|
||
# Include rules for known (previously-built) files | ||
-include $(DEPENDS) | ||
.SUFFIXES: |