diff --git a/Makefile b/Makefile index e7b48090..bed85da5 100644 --- a/Makefile +++ b/Makefile @@ -311,6 +311,8 @@ LIB=lib INSTALL=install MKDIR=mkdir +EXTRA_FILES= +CLIENT_EXTRA_FILES= ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu")) @@ -485,6 +487,7 @@ ifeq ($(PLATFORM),darwin) CLIENT_LIBS += -framework IOKit \ $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib RENDERER_LIBS += -framework OpenGL $(LIBSDIR)/macosx/libSDL2-2.0.0.dylib + CLIENT_EXTRA_FILES=$(LIBSDIR)/macosx/libSDL2-2.0.0.dylib OPTIMIZE = $(OPTIMIZEVM) -ffast-math @@ -628,12 +631,14 @@ ifeq ($(PLATFORM),mingw32) RENDERER_LIBS += $(LIBSDIR)/win32/libSDL2main.a \ $(LIBSDIR)/win32/libSDL2.dll.a SDLDLL=SDL2.dll + CLIENT_EXTRA_FILES += $(LIBSDIR)/win32/SDL2.dll else CLIENT_LIBS += $(LIBSDIR)/win64/libSDL264main.a \ $(LIBSDIR)/win64/libSDL264.dll.a RENDERER_LIBS += $(LIBSDIR)/win64/libSDL264main.a \ $(LIBSDIR)/win64/libSDL264.dll.a SDLDLL=SDL264.dll + CLIENT_EXTRA_FILES += $(LIBSDIR)/win64/SDL264.dll endif else CLIENT_CFLAGS += $(SDL_CFLAGS) @@ -932,12 +937,12 @@ endif ifneq ($(BUILD_CLIENT),0) ifneq ($(USE_RENDERER_DLOPEN),0) TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT) $(B)/renderer_opengl1_$(SHLIBNAME) - ifneq ($(BUILD_RENDERER_OPENGL2), 0) + ifneq ($(BUILD_RENDERER_OPENGL2),0) TARGETS += $(B)/renderer_opengl2_$(SHLIBNAME) endif else TARGETS += $(B)/$(CLIENTBIN)$(FULLBINEXT) - ifneq ($(BUILD_RENDERER_OPENGL2), 0) + ifneq ($(BUILD_RENDERER_OPENGL2),0) TARGETS += $(B)/$(CLIENTBIN)_opengl2$(FULLBINEXT) endif endif @@ -1233,6 +1238,29 @@ else TERM_COLUMNS=76 endif +define ADD_COPY_TARGET +TARGETS += $2 +$2: $1 + $(echo_cmd) "CP $$<" + @cp $1 $2 +endef + +# These functions allow us to generate rules for copying a list of files +# into the base directory of the build; this is useful for bundling libs, +# README files or whatever else +define GENERATE_COPY_TARGETS +$(foreach FILE,$1, \ + $(eval $(call ADD_COPY_TARGET, \ + $(FILE), \ + $(addprefix $(B)/,$(notdir $(FILE)))))) +endef + +$(call GENERATE_COPY_TARGETS,$(EXTRA_FILES)) + +ifneq ($(BUILD_CLIENT),0) + $(call GENERATE_COPY_TARGETS,$(CLIENT_EXTRA_FILES)) +endif + NAKED_TARGETS=$(shell echo $(TARGETS) | sed -e "s!$(B)/!!g") print_list=@for i in $(1); \