diff options
| author | Li Jin <dragon-fly@qq.com> | 2025-11-04 17:00:46 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2025-11-04 17:00:46 +0800 |
| commit | ccd9c7f216c341b50e0a0313ac2eef6a89cee5a4 (patch) | |
| tree | 153ce8766144c7f4288772a1fe668590f60e42a5 /makefile | |
| parent | 03d4fad6ef79ce1788391648e535039a5f29aec3 (diff) | |
| download | yuescript-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-- | makefile | 20 |
1 files changed, 19 insertions, 1 deletions
| @@ -3,6 +3,7 @@ | |||
| 3 | BIN_NAME := yue | 3 | BIN_NAME := yue |
| 4 | # Compiler used | 4 | # Compiler used |
| 5 | CXX ?= g++ | 5 | CXX ?= g++ |
| 6 | CC ?= gcc | ||
| 6 | # Extension of source files used in the project | 7 | # Extension of source files used in the project |
| 7 | SRC_EXT = cpp | 8 | SRC_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 |
| 127 | release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) | 128 | release: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) |
| 129 | release: export CFLAGS := $(CFLAGS) $(filter-out -std=c++17,$(COMPILE_FLAGS)) $(RCOMPILE_FLAGS) | ||
| 128 | release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS) | 130 | release: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(RLINK_FLAGS) |
| 129 | debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS) | 131 | debug: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(DCOMPILE_FLAGS) |
| 132 | debug: export CFLAGS := $(CFLAGS) $(filter-out -std=c++17,$(COMPILE_FLAGS)) $(DCOMPILE_FLAGS) | ||
| 130 | debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS) | 133 | debug: export LDFLAGS := $(LDFLAGS) $(LINK_FLAGS) $(DLINK_FLAGS) |
| 131 | shared: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) $(TARGET_FLAGS) | 134 | shared: export CXXFLAGS := $(CXXFLAGS) $(COMPILE_FLAGS) $(RCOMPILE_FLAGS) $(TARGET_FLAGS) |
| 135 | shared: 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 |
| 134 | release: export BUILD_PATH := build/release | 138 | release: 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)) |
| 164 | endif | 168 | endif |
| 165 | 169 | ||
| 170 | # Add colib ljson.c source file | ||
| 171 | SOURCES += $(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 |
| 168 | OBJECTS = $(SOURCES:$(SRC_PATH)/%.$(SRC_EXT)=$(BUILD_PATH)/%.o) | 175 | CPP_SOURCES = $(filter %.cpp,$(SOURCES)) |
| 176 | C_SOURCES = $(filter %.c,$(SOURCES)) | ||
| 177 | OBJECTS = $(CPP_SOURCES:$(SRC_PATH)/%.cpp=$(BUILD_PATH)/%.o) | ||
| 178 | OBJECTS += $(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 |
| 170 | DEPS = $(OBJECTS:.o=.d) | 180 | DEPS = $(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) | ||
