From 1afca4888b2ee8e49c2e4d0bef478d0728d5ed41 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 13 Aug 2020 11:21:22 +0800 Subject: add make target to build .so file. --- makefile | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index 0c29230..70d6c97 100644 --- a/makefile +++ b/makefile @@ -79,12 +79,15 @@ release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS) debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS) debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS) +shared: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) # Build and output paths release: export BUILD_PATH := build/release release: export BIN_PATH := bin/release debug: export BUILD_PATH := build/debug debug: export BIN_PATH := bin/debug +shared: export BUILD_PATH := build/shared +shared: export BIN_PATH := bin/shared install: export BIN_PATH := bin/release # Find all source files in the source directory, sorted by most @@ -154,7 +157,7 @@ endif .PHONY: release release: dirs ifeq ($(USE_VERSION), true) - @echo "Beginning release build v$(VERSION_STRING)" + @echo "Beginning release build $(VERSION_STRING)" else @echo "Beginning release build" endif @@ -168,7 +171,7 @@ endif .PHONY: debug debug: dirs ifeq ($(USE_VERSION), true) - @echo "Beginning debug build v$(VERSION_STRING)" + @echo "Beginning debug build $(VERSION_STRING)" else @echo "Beginning debug build" endif @@ -178,6 +181,23 @@ endif @echo -n "Total build time: " @$(END_TIME) +$(BUILD_PATH)/moonp.so: src/MoonP/ast.cpp src/MoonP/moon_compiler.cpp src/MoonP/moon_parser.cpp src/MoonP/moonplus.cpp src/MoonP/parser.cpp + $(CMD_PREFIX)$(CXX) $(CXXFLAGS) -I $(SRC_PATH) -I $(LUAI) -L $(LUAL) -llua -o $@ -fPIC -shared $? + +# Standard, non-optimized release build +.PHONY: shared +shared: dirs +ifeq ($(USE_VERSION), true) + @echo "Beginning release build $(VERSION_STRING)" +else + @echo "Beginning release build" +endif + @$(START_TIME) + @$(MAKE) $(BUILD_PATH)/moonp.so --no-print-directory + @echo -n "Total build time: " + @$(END_TIME) + @mv $(BUILD_PATH)/moonp.so $(BIN_PATH)/moonp.so + # Create the directories used in the build .PHONY: dirs dirs: -- cgit v1.2.3-55-g6feb