UltimateZoneBuilder/Makefile

81 lines
1.9 KiB
Makefile
Raw Permalink Normal View History

BUILDTYPE ?= Release
ifdef MINGW
TARGET_EXEC := BuilderNative.dll
else
2023-11-07 10:59:13 +00:00
TARGET_EXEC := libBuilderNative.so
endif
2023-11-07 10:59:13 +00:00
BUILD_DIR := ./Build.Native
SRC_DIRS := ./Source/Native
SRCS := $(shell find $(SRC_DIRS) -name '*.cpp' -or -name '*.c' -or -name '*.s')
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_DIRS := ./Source/Native
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
CPPFLAGS_ := $(INC_FLAGS) -MMD -MP
CFLAGS_ = -O2 -g3 -fPIC -Wall -Wextra -Wno-unused-parameter -Werror
2023-11-07 10:59:13 +00:00
ifdef MINGW
CFLAGS_ += -msse2
endif
2023-11-07 10:59:13 +00:00
CXXFLAGS_ = -std=c++14 $(CFLAGS_)
ifdef MINGW
LDFLAGS_ = -lopengl32 -lgdi32 -shared -Wl,--subsystem,windows
else
LDFLAGS_ = -lX11 -ldl -shared
endif
2023-11-07 10:59:13 +00:00
all: builder Build/$(TARGET_EXEC)
2023-11-07 10:59:13 +00:00
$(BUILD_DIR)/%.c.o: %.c
@mkdir -p $(dir $@)
$(CC) $(CPPFLAGS_) $(CPPFLAGS) $(CFLAGS_) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/%.cpp.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) $(CPPFLAGS_) $(CPPFLAGS) $(CXXFLAGS_) $(CXXFLAGS) -c $< -o $@
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CXX) $(OBJS) $(LDFLAGS_) $(LDFLAGS) -o $@
Build/$(TARGET_EXEC): $(BUILD_DIR)/$(TARGET_EXEC)
2023-11-07 10:59:13 +00:00
cp $< $@
.PHONY: clean
clean:
-rm --force --recursive $(BUILD_DIR)/Source $(BUILD_DIR)/$(TARGET_EXEC) $(BUILD_DIR)/builder $(BUILD_DIR)/Builder.exe Build/libBuilderNative.so
2020-09-11 23:24:20 +00:00
run:
cd Build && mono Builder.exe
linux: builder native
mac: builder nativemac
2023-11-07 10:59:13 +00:00
builder: $(BUILD_DIR)/Builder.exe Build/builder
$(BUILD_DIR)/Builder.exe: BuilderMono.sln Build/builder
msbuild /nologo /verbosity:minimal -p:Configuration=$(BUILDTYPE) BuilderMono.sln
2023-11-07 10:59:13 +00:00
Build/builder:
cp builder.sh Build/builder
chmod +x Build/builder
nativemac:
2023-11-07 10:59:13 +00:00
$(CXX) -std=c++14 -O2 --shared -g3 -o Build/libBuilderNative.so -fPIC -I Source/Native Source/Native/*.cpp Source/Native/OpenGL/*.cpp Source/Native/OpenGL/gl_load/*.c -ldl
native:
2023-11-07 10:59:13 +00:00
$(CXX) -std=c++14 -O2 --shared -g3 -o Build/libBuilderNative.so -fPIC -I Source/Native Source/Native/*.cpp Source/Native/OpenGL/*.cpp Source/Native/OpenGL/gl_load/*.c -lX11 -ldl
-include $(DEPS)