Improved help screen + fixed minor bug in get_executable_path() function.
[setup-launcher.git] / Makefile
blobf574bf8b5514a1415f581cbb029456f75f80f172
1 ##################################################################################################
2 # Setup Bootstrapper 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 OUTPATH_EXE := out/$(APPNAME).exe
24 OUTPATH_DLL := out/$(APPNAME).dll
25 RESPATH_EXE := res/$(APPNAME).exe.o
26 RESPATH_DLL := res/$(APPNAME).dll.o
28 BUILD_TIME := $(shell date +'%s')
29 BUILD_DATE := \
30 -DBUILD_DATE_X=$(shell printf '%08X' $(BUILD_TIME)) \
31 -DBUILD_DATE_F=$(shell date --date='@$(BUILD_TIME)' +'%Y-%m-%d') \
32 -DBUILD_DATE_Y=$(shell date --date='@$(BUILD_TIME)' +'%-Y') \
33 -DBUILD_DATE_M=$(shell date --date='@$(BUILD_TIME)' +'%-m') \
34 -DBUILD_DATE_D=$(shell date --date='@$(BUILD_TIME)' +'%-d')
36 .PHONY: all clean
38 all: $(OUTPATH_EXE) $(OUTPATH_DLL)
40 $(OUTPATH_EXE): setup-launcher.c $(RESPATH_EXE)
41 mkdir -p $(dir $@)
42 gcc -O2 -static -DBUILD_EXE $(BUILD_DATE) -o $@ -mwindows -municode $?
43 for i in {1..5}; do strip $@ && break; done
45 $(OUTPATH_DLL): setup-launcher.c $(RESPATH_DLL) setup-launcher.def
46 mkdir -p $(dir $@)
47 gcc -O2 -shared -DBUILD_DLL $(BUILD_DATE) -o $@ -mwindows -Wl,--enable-stdcall-fixup $?
48 for i in {1..5}; do strip $@ && break; done
50 $(RESPATH_EXE): resources.rc
51 mkdir -p $(dir $@)
52 windres -DBUILD_EXE $(BUILD_DATE) -o $@ $<
54 $(RESPATH_DLL): resources.rc
55 mkdir -p $(dir $@)
56 windres -DBUILD_DLL $(BUILD_DATE) -o $@ $<
58 clean:
59 rm -vf $(dir $(RESPATH_EXE))*.o
60 rm -vf $(dir $(OUTPATH_EXE))*.{exe,dll}