2020-09-25 18:46:12 +00:00
|
|
|
BUILDTYPE ?= Release
|
|
|
|
|
2023-11-08 03:42:25 +00:00
|
|
|
ifdef MINGW
|
|
|
|
TARGET_EXEC := BuilderNative.dll
|
|
|
|
else
|
2023-11-07 10:59:13 +00:00
|
|
|
TARGET_EXEC := libBuilderNative.so
|
2023-11-08 03:42:25 +00:00
|
|
|
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
|
|
|
|
|
2023-11-12 19:46:25 +00:00
|
|
|
CFLAGS_ = -O2 -g3 -fPIC -Wall -Wextra -Wno-unused-parameter -Werror
|
2023-11-07 10:59:13 +00:00
|
|
|
|
2023-11-08 04:50:29 +00:00
|
|
|
ifdef MINGW
|
|
|
|
CFLAGS_ += -msse2
|
|
|
|
endif
|
|
|
|
|
2023-11-07 10:59:13 +00:00
|
|
|
CXXFLAGS_ = -std=c++14 $(CFLAGS_)
|
|
|
|
|
2023-11-08 03:42:25 +00:00
|
|
|
ifdef MINGW
|
2023-11-12 19:46:25 +00:00
|
|
|
LDFLAGS_ = -lopengl32 -lgdi32 -shared -Wl,--subsystem,windows
|
2023-11-08 03:42:25 +00:00
|
|
|
else
|
2023-11-12 19:46:25 +00:00
|
|
|
LDFLAGS_ = -lX11 -ldl -shared
|
2023-11-08 03:42:25 +00:00
|
|
|
endif
|
2023-11-07 10:59:13 +00:00
|
|
|
|
2023-11-08 03:42:25 +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 $@
|
|
|
|
|
2023-11-08 03:42:25 +00:00
|
|
|
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-01-06 07:52:59 +00:00
|
|
|
|
2020-09-11 23:24:20 +00:00
|
|
|
run:
|
|
|
|
cd Build && mono Builder.exe
|
|
|
|
|
2020-01-06 07:52:59 +00:00
|
|
|
linux: builder native
|
|
|
|
|
|
|
|
mac: builder nativemac
|
2019-09-10 03:30:14 +00:00
|
|
|
|
2023-11-07 10:59:13 +00:00
|
|
|
builder: $(BUILD_DIR)/Builder.exe Build/builder
|
|
|
|
|
|
|
|
$(BUILD_DIR)/Builder.exe: BuilderMono.sln Build/builder
|
2020-09-25 18:46:12 +00:00
|
|
|
msbuild /nologo /verbosity:minimal -p:Configuration=$(BUILDTYPE) BuilderMono.sln
|
2023-11-07 10:59:13 +00:00
|
|
|
|
|
|
|
Build/builder:
|
2020-09-20 09:41:28 +00:00
|
|
|
cp builder.sh Build/builder
|
|
|
|
chmod +x Build/builder
|
2020-01-06 07:52:59 +00:00
|
|
|
|
|
|
|
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
|
2019-09-10 03:30:14 +00:00
|
|
|
|
|
|
|
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)
|