a1513511d44996528707074727430489591c5202
[fltk_mvc_template.git] / _template / packages / fltk1.3.4 / 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
9 # Add android ndk toolchain
10 export PATH := /usr/lib/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/:$(PATH)
11
12 all: unpack windows linux32 linux_arm android_arm
13
14 .PHONY: unpack
15 unpack:
16         tar xvzf fltk-1.3.4-1-source.tar.gz
17
18 .PHONY: windows
19 windows:
20         mkdir -p $(WORKDIR)/../../lib_include/mingw32/X11
21         cp /usr/include/X11/Xmd.h ../../lib_include/mingw32/X11/
22         cp /usr/include/X11/cursorfont.h ../../lib_include/mingw32/X11/
23         cd $(WORKDIR)/fltk-1.3.4-1; \
24         make clean; \
25         ./configure CFLAGS="-m32 -mwindows" CXXFLAGS="-m32 -mwindows" LDFLAGS="-m32 -static -static-libgcc -static-libstdc++ -lpthread"  --enable-static --host=i686-w64-mingw32 --enable-cygwin --enable-localjpeg --enable-localzlib --enable-localpng --disable-xcursor --disable-xinerama --disable-xft --disable-xdbe --disable-xrender --disable-xfixes; \
26         make -j6
27         mkdir -p $(WORKDIR)/../../lib_include/mingw32
28         mkdir -p $(WORKDIR)/../../lib/mingw32
29         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../lib_include/mingw32
30         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/mingw32
31
32 .PHONY: linux32
33 linux32:
34         mkdir -p $(WORKDIR)/../../lib_include/linux32/X11
35         cp /usr/include/X11/Xmd.h ../../lib_include/linux32/X11/
36         cp /usr/include/X11/cursorfont.h ../../lib_include/linux32/X11/
37         cd $(WORKDIR)/fltk-1.3.4-1; \
38         make clean; \
39         ./configure CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32 -static-libgcc -static-libstdc++" --enable-static --enable-localjpeg --enable-localzlib --enable-localpng --disable-xcursor --disable-xinerama --disable-xft --disable-xdbe --disable-xrender --disable-xfixes; \
40         make -j6
41         mkdir -p $(WORKDIR)/../../lib_include/linux32
42         mkdir -p $(WORKDIR)/../../lib/linux32
43         mkdir -p $(WORKDIR)/../../tools
44         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../lib_include/linux32
45         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/linux32
46         cp -rf $(WORKDIR)/fltk-1.3.4-1/fluid/fluid $(WORKDIR)/../../tools
47
48 .PHONY: linux_arm
49 linux_arm:
50         mkdir -p $(WORKDIR)/../../lib_include/linux_arm/X11
51         cp /usr/include/X11/Xmd.h ../../lib_include/linux_arm/X11/
52         cp /usr/include/X11/cursorfont.h ../../lib_include/linux_arm/X11/
53         cd $(WORKDIR)/fltk-1.3.4-1; \
54         make clean; \
55         ./configure CFLAGS="" CXXFLAGS="" LDFLAGS="-static-libgcc -static-libstdc++" --host=arm-linux-gnueabihf  --enable-static --enable-localjpeg --enable-localzlib --enable-localpng --disable-xcursor --disable-xinerama --disable-xft --disable-xdbe --disable-xrender --disable-xfixes; \
56         make -j6
57         mkdir -p $(WORKDIR)/../../lib_include/linux_arm
58         mkdir -p $(WORKDIR)/../../lib/linux_arm
59         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../lib_include/linux_arm
60         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/linux_arm
61
62 .PHONY: linux_nanox
63 linux_nanox:
64         mkdir -p $(WORKDIR)/../../lib_include/linux32/X11
65         cp /usr/include/X11/Xmd.h ../../lib_include/linux32/X11/
66         cp /usr/include/X11/cursorfont.h ../../lib_include/linux32/X11/
67         cd $(WORKDIR)/fltk-1.3.4-1; \
68         make clean; \
69         ./configure CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32 -static-libgcc -static-libstdc++" --enable-static --x-includes=../../../../lib_include/linux32  --x-libraries=../../../../lib/linux32 --enable-localjpeg --enable-localzlib --enable-localpng --disable-gl --disable-xinerama --disable-xft --disable-xdbe --disable-xfixes --disable-xcursor --disable-xrender; \
70         sed -i -e 's/-lX11/-lNX11 -lnano-X/g' ./makeinclude; \
71         sed -i -e 's/-lX11/-lNX11 -lnano-X/g' ./fltk-config; \
72         sed -i -e '/#define USE_XRANDR/ a #undef USE_XRANDR' ./src/Fl_x.cxx; \
73         sed -i -e '/#define USE_XRANDR/ a #undef USE_XRANDR' ./src/screen_xywh.cxx; \
74         make -k -j6
75         mkdir -p $(WORKDIR)/../../lib_include/linux32
76         mkdir -p $(WORKDIR)/../../lib/linux32
77         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../lib_include/linux32
78         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/linux32
79
80 .PHONY: android_arm
81 android_arm:
82         mkdir -p $(WORKDIR)/../../lib_include/android_arm/X11
83         cp /usr/include/X11/Xmd.h ../../lib_include/android_arm/X11/
84         cp /usr/include/X11/cursorfont.h ../../lib_include/android_arm/X11/
85         cd $(WORKDIR)/fltk-1.3.4-1; \
86         make clean; \
87         ./configure CFLAGS="--sysroot=/usr/lib/android-ndk/platforms/android-23/arch-arm" CXXFLAGS="--sysroot=/usr/lib/android-ndk/platforms/android-23/arch-arm" LDFLAGS="-static-libgcc -static-libstdc++ --sysroot=/usr/lib/android-ndk/platforms/android-23/arch-arm" --enable-static  --x-includes=../../../../lib_include/android_arm --x-libraries=../../../../lib/android_arm --host=arm-linux-androideabi --enable-localjpeg --enable-localzlib --enable-localpng --disable-gl --disable-xinerama --disable-xft --disable-xdbe --disable-xfixes --disable-xcursor --disable-xrender; \
88         sed -i -e 's/-lX11/-lNX11 -lnano-X/g' ./makeinclude; \
89         sed -i -e 's/-lX11/-lNX11 -lnano-X/g' ./fltk-config; \
90         sed -i -e '/#define USE_XRANDR/ a #undef USE_XRANDR' ./src/Fl_x.cxx; \
91         sed -i -e '/#define USE_XRANDR/ a #undef USE_XRANDR' ./src/screen_xywh.cxx; \
92         sed -i -e 's/char \*pc_dl_error/const char \*pc_dl_error/g' ./src/Fl_Native_File_Chooser_GTK.cxx; \
93         make -i -j6
94         mkdir -p $(WORKDIR)/../../lib_include/android_arm
95         mkdir -p $(WORKDIR)/../../lib/android_arm
96         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../lib_include/android_arm
97         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/android_arm
98
99 .PHONY: clean
100 clean:
101         rm -rf $(WORKDIR)/fltk-1.3.4-1