Restructure src folder. Add asset folder. Automatically pack files from asset folder...
[fltk_mvc_template.git] / _template / Makefile
1 ############################################################################
2 # Workfile: Makefile
3 # Author: Daniel Giritzer, S1810567004 (daniel@giritzer.eu)
4 # Date: 03.12.2018
5 # Description: Universal Makefile for Unix based Operating Systems
6 ############################################################################
7 WORKDIR = $(shell pwd)
8 APPINFO = $(WORKDIR)/src/appinfo
9
10 all: deps _template create_installers
11 deps: freetype allegro nanox fltk
12 create_installers: linux32_package linux_arm_package windows_package android_package
13
14 #### Dependencies
15 freetype:
16         cd $(WORKDIR)/packages/freetype2.9.1; \
17         make
18
19 allegro:
20         cd $(WORKDIR)/packages/allegro5.1.13; \
21         make
22
23 nanox:
24         cd $(WORKDIR)/packages/nanox; \
25         make
26
27 fltk:
28         cd $(WORKDIR)/packages/fltk1.3.4; \
29         make
30
31 tinyxml:
32         cd $(WORKDIR)/packages/tinyxml2; \
33         make
34
35 libsndfile:
36         cd $(WORKDIR)/packages/libsndfile1.0.28; \
37         make
38
39 libao:
40         cd $(WORKDIR)/packages/libao1.2.2; \
41         make
42
43 gtest:
44         cd $(WORKDIR)/packages/googletest1.8.1; \
45         make
46
47 boost:
48         cd $(WORKDIR)/packages/boost1.68.0; \
49         make
50
51 tinyalsa:
52         cd $(WORKDIR)/packages/tinyalsa1.0.2; \
53         make
54
55 alsa:
56         cd $(WORKDIR)/packages/alsa-lib1.1.8; \
57         make
58
59 #### _template App
60 _template:
61         cd $(WORKDIR)/src; \
62         make
63
64
65 #### Clean
66 clean_freetype:
67         cd $(WORKDIR)/packages/freetype2.9.1; \
68         make clean
69
70 clean_allegro:
71         cd $(WORKDIR)/packages/allegro5.1.13; \
72         make clean
73
74 clean_nanox:
75         cd $(WORKDIR)/packages/nanox; \
76         make clean
77
78 clean_fltk:
79         cd $(WORKDIR)/packages/fltk1.3.4; \
80         make clean
81
82 clean_tinyxml:
83         cd $(WORKDIR)/packages/tinyxml2; \
84         make clean
85
86 clean_libsndfile:
87         cd $(WORKDIR)/packages/libsndfile1.0.28; \
88         make clean
89
90 clean_libao:
91         cd $(WORKDIR)/packages/libao1.2.2; \
92         make clean
93
94 clean_gtest:
95         cd $(WORKDIR)/packages/googletest1.8.1; \
96         make clean
97
98 clean_boost:
99         cd $(WORKDIR)/packages/boost1.68.0; \
100         make clean
101
102 clean_tinyalsa:
103         cd $(WORKDIR)/packages/tinyalsa1.0.2; \
104         make clean
105
106 clean_alsa:
107         cd $(WORKDIR)/packages/alsa-lib1.1.8; \
108         make clean
109
110 clean__template:
111         cd $(WORKDIR)/src; \
112         make clean
113
114 clean_lib:
115         rm -rf $(WORKDIR)/lib/
116         rm -rf $(WORKDIR)/tools/
117         find $(WORKDIR)/include/ ! -name 'json.h' ! -name '.gitignore' -type f -exec rm -f {} +
118         find $(WORKDIR)/include/ -maxdepth 1 -mindepth 1 -type d -exec rm -rf '{}' \;
119
120 ### Create packages
121 linux32_package:
122         mkdir -p $(WORKDIR)/install_package/linux32/lib
123         mkdir -p $(WORKDIR)/install_package/linux32/bin
124         $(WORKDIR)/scripts/copydeps.sh $(WORKDIR)/src/bin/Release_Linux32/_template $(WORKDIR)/install_package/linux32/lib
125         cp $(WORKDIR)/src/bin/Release_Linux32/_template $(WORKDIR)/install_package/linux32/bin
126         cp -r $(WORKDIR)/src/assets/* $(WORKDIR)/install_package/linux32/
127         cp $(APPINFO)/start__template $(WORKDIR)/install_package/linux32/
128         cp $(APPINFO)/start__template.desktop $(WORKDIR)/install_package/linux32/
129         cp $(APPINFO)/Icon.png $(WORKDIR)/install_package/linux32/
130         tar -zcvf $(WORKDIR)/install_package/install__template_linux32 -C $(WORKDIR)/install_package/linux32/ .
131         $(WORKDIR)/scripts/gen_package_linux.sh $(WORKDIR)/install_package/install__template_linux32
132         rm $(WORKDIR)/install_package/install__template_linux32 
133
134 linux_arm_package:
135         mkdir -p $(WORKDIR)/install_package/linux_arm/lib
136         mkdir -p $(WORKDIR)/install_package/linux_arm/bin
137         $(WORKDIR)/scripts/copydeps.sh $(WORKDIR)/src/bin/Release_LinuxARM/_template $(WORKDIR)/install_package/linux_arm/lib
138         cp $(WORKDIR)/src/bin/Release_LinuxARM/_template $(WORKDIR)/install_package/linux_arm/bin
139         cp -r $(WORKDIR)/src/assets/* $(WORKDIR)/install_package/linux_arm/
140         cp $(APPINFO)/start__template $(WORKDIR)/install_package/linux_arm/
141         cp $(APPINFO)/start__template.desktop $(WORKDIR)/install_package/linux_arm/
142         cp $(APPINFO)/Icon.png $(WORKDIR)/install_package/linux_arm/
143         tar -zcvf $(WORKDIR)/install_package/install__template_linux_arm -C $(WORKDIR)/install_package/linux_arm/ .
144         $(WORKDIR)/scripts/gen_package_linux.sh $(WORKDIR)/install_package/install__template_linux_arm
145         rm $(WORKDIR)/install_package/install__template_linux_arm 
146
147 windows_package:
148         mkdir -p $(WORKDIR)/install_package/windows/
149         cp $(WORKDIR)/src/bin/Release_Windows/_template.exe $(WORKDIR)/install_package/windows/
150         cp -r $(WORKDIR)/src/assets/* $(WORKDIR)/install_package/windows/
151         cd $(WORKDIR)/scripts/; \
152         ./gen_package_windows.sh $(WORKDIR)/install_package/windows/*; \
153         mv ./*.exe $(WORKDIR)/install_package/install__template_windows.exe
154
155 android_package:
156         mkdir -p $(WORKDIR)/install_package/
157         cp $(WORKDIR)/src/bin/Android/_template.apk $(WORKDIR)/install_package/install__template_android.apk
158
159 clean: clean_lib clean__template clean_fltk  clean_tinyxml clean_allegro clean_nanox clean_freetype clean_libsndfile clean_libao clean_boost clean_gtest clean_tinyalsa clean_alsa