diff options
author | Adrian Kummerländer | 2013-09-27 18:02:33 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2013-09-27 18:02:33 +0200 |
commit | c04051c034a5de33ba25e3182191d854edbbb516 (patch) | |
tree | 4b2834c80e06775eac0c2a6e49d8a66c93978d71 /Makefile | |
parent | a0f0c005a39ddaf693c7de84d6ab1c380a93dca2 (diff) | |
download | SimpleParser-c04051c034a5de33ba25e3182191d854edbbb516.tar SimpleParser-c04051c034a5de33ba25e3182191d854edbbb516.tar.gz SimpleParser-c04051c034a5de33ba25e3182191d854edbbb516.tar.bz2 SimpleParser-c04051c034a5de33ba25e3182191d854edbbb516.tar.lz SimpleParser-c04051c034a5de33ba25e3182191d854edbbb516.tar.xz SimpleParser-c04051c034a5de33ba25e3182191d854edbbb516.tar.zst SimpleParser-c04051c034a5de33ba25e3182191d854edbbb516.zip |
Modified Makefile to generate shared library
* library is called libSimpleParser.so
* parser was renamed to clc
* test and clc are using the shared library
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 53 |
1 files changed, 40 insertions, 13 deletions
@@ -1,19 +1,46 @@ -LIB_FILES = src/nodes.cc src/tree.cc src/utils.cc -PROG_FILES = main.cc -TEST_FILES = test.cc +CXX = g++ +CXXFLAGS = -std=c++11 -W -Wall -Wextra -pedantic -fpic -FLAGS = -std=c++11 -W -Wall -Wextra -pedantic -PARSER = -o bin/parser $(FLAGS) $(PROG_FILES) $(LIB_FILES) +SRC_DIR = src +BIN_DIR = bin -all: dev test +LIB_SRC = $(SRC_DIR)/nodes.cc \ + $(SRC_DIR)/tree.cc \ + $(SRC_DIR)/utils.cc \ + $(SRC_DIR)/parser.cc +LIB_OBJ = $(subst .cc,.o,$(LIB_SRC)) -dev: $(PROG_FILES) $(LIB_FILES) - g++ -g $(PARSER) +TEST_SRC = test.cc +CLC_SRC = clc.cc -release: $(PROG_FILES) $(LIB_FILES) - g++ -O3 $(PARSER) +all: lib test clc -test: $(LIB_FILES) $(TEST_FILES) - g++ -O3 -o bin/test -lgtest $(TEST_FILES) $(FLAGS) $(LIB_FILES) - ./bin/test +lib: $(BIN_DIR)/libSimpleParser.so; +test: $(BIN_DIR)/test; +clc: $(BIN_DIR)/clc; +$(BIN_DIR)/libSimpleParser.so: $(LIB_OBJ) + $(CXX) -shared -o $(BIN_DIR)/libSimpleParser.so $(LIB_OBJ) $(CXXFLAGS) + +$(BIN_DIR)/test: $(BIN_DIR)/libSimpleParser.so + $(CXX) -o $(BIN_DIR)/test $(TEST_SRC) -lgtest -L$(BIN_DIR)/ -lSimpleParser + ./$(BIN_DIR)/test + +$(BIN_DIR)/clc: $(BIN_DIR)/libSimpleParser.so + $(CXX) -o $(BIN_DIR)/clc $(CLC_SRC) -L$(BIN_DIR)/ -lSimpleParser + +install: $(BIN_DIR)/libSimpleParser.so $(BIN_DIR)/clc + install -m 0755 $(BIN_DIR)/libSimpleParser.so /usr/lib + install -m 0755 $(BIN_DIR)/clc /usr/bin + +.PHONY: clean; +clean: + rm -f $(LIB_OBJ) + rm -f $(BIN_DIR)/* + +depend: .depend + +.depend: $(LIB_SRC) + $(CXX) -M $(CXXFLAGS) $< > $@ + +include .depend |