Some Makefile improvements + verify the version tag in DLL entry point.
[setup-launcher.git] / Makefile
blobe0c8d4ff4f1f65b2d18935cb312cb89eb451df01
1 ##################################################################################################
2 # Setup Launcher Utility #
3 # Copyright(c) 2016-2020 LoRd_MuldeR <mulder2@gmx.de> #
4 # #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy of this software #
6 # and associated documentation files (the "Software"), to deal in the Software without #
7 # restriction, including without limitation the rights to use, copy, modify, merge, publish, #
8 # distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the #
9 # Software is furnished to do so, subject to the following conditions: #
10 # #
11 # The above copyright notice and this permission notice shall be included in all copies or #
12 # substantial portions of the Software. #
13 # #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING #
15 # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND #
16 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, #
17 # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
19 ##################################################################################################
21 APPNAME := setup-launcher
23 BUILD_TIME := $(shell date +'%s')
24 BUILD_DATE := \
25 -DBUILD_DATE_X=$(shell printf '%08X' $(BUILD_TIME)) \
26 -DBUILD_DATE_F=$(shell date --date='@$(BUILD_TIME)' +'%Y-%m-%d') \
27 -DBUILD_DATE_Y=$(shell date --date='@$(BUILD_TIME)' +'%-Y') \
28 -DBUILD_DATE_M=$(shell date --date='@$(BUILD_TIME)' +'%-m') \
29 -DBUILD_DATE_D=$(shell date --date='@$(BUILD_TIME)' +'%-d')
31 .PHONY: all clean
33 all: $(APPNAME).exe $(APPNAME).dll
35 $(APPNAME).exe: setup-launcher.c resources.exe.o
36 gcc -O2 -static -DBUILD_EXE $(BUILD_DATE) -o $@ -mwindows -municode $?
37 for i in {1..5}; do strip $(APPNAME).exe && break; done
39 $(APPNAME).dll: setup-launcher.c resources.dll.o setup-launcher.def
40 gcc -O2 -shared -DBUILD_DLL $(BUILD_DATE) -o $@ -mwindows -Wl,--enable-stdcall-fixup $?
41 for i in {1..5}; do strip $(APPNAME).dll && break; done
43 resources.exe.o: resources.rc
44 windres -DBUILD_EXE $(BUILD_DATE) -o $@ $<
46 resources.dll.o: resources.rc
47 windres -DBUILD_DLL $(BUILD_DATE) -o $@ $<
49 clean:
50 rm -vf *.o $(APPNAME).{exe,dll}