Permalink
Browse files

Simplify, improve `release` target in Makefiles

  • Loading branch information...
blacktm committed Aug 23, 2017
1 parent 9833860 commit 0b0b893d67d8b209494c968f22ec7e05ac785af1
Showing with 34 additions and 36 deletions.
  1. +21 −22 Makefile
  2. +13 −14 NMakefile
View
@@ -39,9 +39,8 @@ OBJECTS=$(addprefix build/,$(notdir $(SOURCES:.c=.o)))
VERSION=$(shell bash bin/simple2d.sh -v)
# Release directories and archive filenames
MINGW_RELEASE_DIR=build/simple2d-windows-mingw-$(VERSION)
MINGW_RELEASE_FNAME=simple2d-windows-mingw-$(VERSION).zip
APPLE_RELEASE_DIR=simple2d-apple-frameworks-$(VERSION)
APPLE_RELEASE=simple2d-apple-frameworks-$(VERSION)
MINGW_RELEASE=simple2d-windows-mingw-$(VERSION)
# Helper functions
@@ -100,6 +99,7 @@ frameworks:
ifneq ($(XCPRETTY_STATUS),0)
@echo "xcpretty not found: Run \`gem install xcpretty\` for nicer xcodebuild output.\n"
endif
mkdir -p build
cp -R deps/xcode/Simple2D.xcodeproj build
cd build && \
xcodebuild -sdk iphoneos | $(XCPRETTY) && \
@@ -142,35 +142,34 @@ endif
ifeq ($(PLATFORM),apple)
release: clean frameworks
$(call task_msg,Building iOS and tvOS release)
mkdir -p build/$(APPLE_RELEASE_DIR)/Simple2D/iOS
mkdir -p build/$(APPLE_RELEASE_DIR)/Simple2D/tvOS
cp -R build/ios/* build/$(APPLE_RELEASE_DIR)/Simple2D/iOS/
cp -R build/tvos/* build/$(APPLE_RELEASE_DIR)/Simple2D/tvOS/
cd build; zip -rq $(APPLE_RELEASE_DIR).zip $(APPLE_RELEASE_DIR)
$(call info_msg,Frameworks zipped at \`build/$(APPLE_RELEASE_DIR).zip\`)
mkdir -p build/$(APPLE_RELEASE)/Simple2D/iOS
mkdir -p build/$(APPLE_RELEASE)/Simple2D/tvOS
cp -R build/ios/* build/$(APPLE_RELEASE)/Simple2D/iOS/
cp -R build/tvos/* build/$(APPLE_RELEASE)/Simple2D/tvOS/
cd build; zip -rq $(APPLE_RELEASE).zip $(APPLE_RELEASE)
$(call info_msg,Frameworks zipped at \`build/$(APPLE_RELEASE).zip\`)
endif
ifeq ($(PLATFORM),mingw)
release: clean all
mkdir -p $(MINGW_RELEASE_DIR)/include
mkdir -p $(MINGW_RELEASE_DIR)/lib
mkdir -p $(MINGW_RELEASE_DIR)/bin
cp -R deps/mingw/include/* $(MINGW_RELEASE_DIR)/include
cp -R deps/mingw/lib/* $(MINGW_RELEASE_DIR)/lib
cp -R deps/mingw/bin/* $(MINGW_RELEASE_DIR)/bin
cp deps/LICENSES.md $(MINGW_RELEASE_DIR)
cp include/simple2d.h $(MINGW_RELEASE_DIR)/include
cp build/libsimple2d.a $(MINGW_RELEASE_DIR)/lib
cp build/simple2d $(MINGW_RELEASE_DIR)/bin
cp bin/win-installer-mingw.sh $(MINGW_RELEASE_DIR)/install.sh
PowerShell -Command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('$(MINGW_RELEASE_DIR)', 'build\$(MINGW_RELEASE_FNAME)'); }"
mkdir -p build/$(MINGW_RELEASE)/include
mkdir -p build/$(MINGW_RELEASE)/lib
mkdir -p build/$(MINGW_RELEASE)/bin
cp -R deps/mingw/include/* build/$(MINGW_RELEASE)/include
cp -R deps/mingw/lib/* build/$(MINGW_RELEASE)/lib
cp -R deps/mingw/bin/* build/$(MINGW_RELEASE)/bin
cp deps/LICENSES.md build/$(MINGW_RELEASE)
cp include/simple2d.h build/$(MINGW_RELEASE)/include
cp build/libsimple2d.a build/$(MINGW_RELEASE)/lib
cp build/simple2d build/$(MINGW_RELEASE)/bin
cp bin/win-installer-mingw.sh build/$(MINGW_RELEASE)/install.sh
PowerShell -Command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('build/$(MINGW_RELEASE)', 'build/\$(MINGW_RELEASE).zip'); }"
endif
clean:
$(call task_msg,Cleaning)
rm -rf build/*
ifeq ($(PLATFORM),mingw)
rm -rf $(MINGW_RELEASE_DIR)
rm -f test/auto.exe
rm -f test/triangle.exe
rm -f test/testcard.exe
View
@@ -23,9 +23,8 @@ LIBS=opengl32.lib $(LIB_GLEW) $(LIB_SDL2) $(LIB_SDL2_MAIN) $(LIB_SDL2_IMAGE) $(L
# Install directory: C:\Users\<user_name>\AppData\Local
INSTALL_DIR=$(LOCALAPPDATA)\simple2d
# Install directory and filename for the VC Windows installer
INSTALLER_DIR=build\win-installer-vc
INSTALLER_FNAME=simple2d-windows-vc.zip
# Install directory and filename for the release
VC_RELEASE=simple2d-windows-vc-VERSION
all: build
@@ -47,19 +46,19 @@ install:
copy build\simple2d.dll $(INSTALL_DIR)
copy bin\simple2d.cmd $(INSTALL_DIR)
installer: uninstall clean build install
if not exist $(INSTALLER_DIR)\simple2d mkdir $(INSTALLER_DIR)\simple2d
xcopy /e /y $(INSTALL_DIR) $(INSTALLER_DIR)\simple2d
copy deps\LICENSES.md $(INSTALLER_DIR)
copy bin\win-installer-vc.cmd $(INSTALLER_DIR)\install.cmd
PowerShell -Command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('$(INSTALLER_DIR)', 'build\$(INSTALLER_FNAME)'); }"
release: uninstall clean build install
if not exist build\$(VC_RELEASE)\simple2d mkdir build\$(VC_RELEASE)\simple2d
xcopy /e /y $(INSTALL_DIR) build\$(VC_RELEASE)\simple2d
copy deps\LICENSES.md build\$(VC_RELEASE)
copy bin\win-installer-vc.cmd build\$(VC_RELEASE)\install.cmd
PowerShell -Command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('build\$(VC_RELEASE)', 'build\$(VC_RELEASE).zip'); }"
clean:
if exist $(INSTALLER_DIR) rmdir /s /q $(INSTALLER_DIR)
if exist build\$(INSTALLER_FNAME) del build\$(INSTALLER_FNAME)
if exist build\simple2d.lib del build\simple2d.lib
if exist build\simple2d.dll del build\simple2d.dll
if exist test\*.exe del test\*.exe
if exist build\$(VC_RELEASE) rmdir /s /q build\$(VC_RELEASE)
if exist build\$(VC_RELEASE).zip del build\$(VC_RELEASE).zip
if exist build\simple2d.lib del build\simple2d.lib
if exist build\simple2d.dll del build\simple2d.dll
if exist test\*.exe del test\*.exe
uninstall:
if exist $(INSTALL_DIR) rmdir /s /q $(INSTALL_DIR)

0 comments on commit 0b0b893

Please sign in to comment.