aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2025-11-04 17:00:46 +0800
committerLi Jin <dragon-fly@qq.com>2025-11-04 17:00:46 +0800
commitccd9c7f216c341b50e0a0313ac2eef6a89cee5a4 (patch)
tree153ce8766144c7f4288772a1fe668590f60e42a5 /makefile
parent03d4fad6ef79ce1788391648e535039a5f29aec3 (diff)
downloadyuescript-ccd9c7f216c341b50e0a0313ac2eef6a89cee5a4.tar.gz
yuescript-ccd9c7f216c341b50e0a0313ac2eef6a89cee5a4.tar.bz2
yuescript-ccd9c7f216c341b50e0a0313ac2eef6a89cee5a4.zip
Included a minimal json lib in yue compiler tool.
Diffstat (limited to 'makefile')
-rw-r--r--makefile20
1 files changed, 19 insertions, 1 deletions
diff --git a/makefile b/makefile
index acdeb1b..9c2f1da 100644
--- a/makefile
+++ b/makefile
@@ -3,6 +3,7 @@
3BIN_NAME := yue 3BIN_NAME := yue
4# Compiler used 4# Compiler used
5CXX ?= g++ 5CXX ?= g++
6CC ?= gcc
6# Extension of source files used in the project 7# Extension of source files used in the project
7SRC_EXT = cpp 8SRC_EXT = cpp
8# Path to the source directory, relative to the makefile 9# Path to the source directory, relative to the makefile
@@ -125,10 +126,13 @@ endif
125 126
126# Combine compiler and linker flags 127# Combine compiler and linker flags
127release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) 128release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS)
129release: export CFLAGS := $(CFLAGS) $(filter-out -std=c++17,$(COMPILE_FLAGS)) $(RCOMPILE_FLAGS)
128release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS) 130release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS)
129debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS) 131debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS)
132debug: export CFLAGS := $(CFLAGS) $(filter-out -std=c++17,$(COMPILE_FLAGS)) $(DCOMPILE_FLAGS)
130debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS) 133debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS)
131shared: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) $(TARGET_FLAGS) 134shared: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) $(TARGET_FLAGS)
135shared: export CFLAGS := $(CFLAGS) $(filter-out -std=c++17,$(COMPILE_FLAGS)) $(RCOMPILE_FLAGS) $(TARGET_FLAGS)
132 136
133# Build and output paths 137# Build and output paths
134release: export BUILD_PATH := build/release 138release: export BUILD_PATH := build/release
@@ -163,9 +167,15 @@ ifeq ($(NO_LUA),true)
163 SOURCES := $(filter-out $(SRC_PATH)/yuescript/yuescript.cpp, $(SOURCES)) 167 SOURCES := $(filter-out $(SRC_PATH)/yuescript/yuescript.cpp, $(SOURCES))
164endif 168endif
165 169
170# Add colib ljson.c source file
171SOURCES += $(SRC_PATH)/3rdParty/colib/ljson.c
172
166# Set the object file names, with the source directory stripped 173# Set the object file names, with the source directory stripped
167# from the path, and the build path prepended in its place 174# from the path, and the build path prepended in its place
168OBJECTS = $(SOURCES:$(SRC_PATH)/%.$(SRC_EXT)=$(BUILD_PATH)/%.o) 175CPP_SOURCES = $(filter %.cpp,$(SOURCES))
176C_SOURCES = $(filter %.c,$(SOURCES))
177OBJECTS = $(CPP_SOURCES:$(SRC_PATH)/%.cpp=$(BUILD_PATH)/%.o)
178OBJECTS += $(C_SOURCES:$(SRC_PATH)/%.c=$(BUILD_PATH)/%.o)
169# Set the dependency files that will be used to add header dependencies 179# Set the dependency files that will be used to add header dependencies
170DEPS = $(OBJECTS:.o=.d) 180DEPS = $(OBJECTS:.o=.d)
171 181
@@ -469,3 +479,11 @@ $(BUILD_PATH)/%.o: $(SRC_PATH)/%.$(SRC_EXT)
469 $(CMD_PREFIX)$(CXX) $(CXXFLAGS) $(INCLUDES) -MP -MMD -c $< -o $@ 479 $(CMD_PREFIX)$(CXX) $(CXXFLAGS) $(INCLUDES) -MP -MMD -c $< -o $@
470 @echo -en "\t Compile time: " 480 @echo -en "\t Compile time: "
471 @$(END_TIME) 481 @$(END_TIME)
482
483# C source file rules
484$(BUILD_PATH)/%.o: $(SRC_PATH)/%.c
485 @echo "Compiling: $< -> $@"
486 @$(START_TIME)
487 $(CMD_PREFIX)$(CC) $(CFLAGS) $(INCLUDES) -MP -MMD -c $< -o $@
488 @echo -en "\t Compile time: "
489 @$(END_TIME)