Added version number to package folder (allow different versions of a package)
[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         mkdir -p $(WORKDIR)/../../include/X11
18         cp /usr/include/X11/Xmd.h ../../include/X11/
19         cp /usr/include/X11/cursorfont.h ../../include/X11/
20
21 .PHONY: windows
22 windows:
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 -j4
27         mkdir -p $(WORKDIR)/../../include
28         mkdir -p $(WORKDIR)/../../lib/mingw32
29         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../include
30         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/mingw32
31
32 .PHONY: linux32
33 linux32:
34         cd $(WORKDIR)/fltk-1.3.4-1; \
35         make clean; \
36         ./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; \
37         make -j4
38         mkdir -p $(WORKDIR)/../../include
39         mkdir -p $(WORKDIR)/../../lib/linux32
40         mkdir -p $(WORKDIR)/../../tools
41         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../include
42         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/linux32
43         cp -rf $(WORKDIR)/fltk-1.3.4-1/fluid/fluid $(WORKDIR)/../../tools
44
45 .PHONY: linux_arm
46 linux_arm:
47         cd $(WORKDIR)/fltk-1.3.4-1; \
48         make clean; \
49         ./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; \
50         make -j4
51         mkdir -p $(WORKDIR)/../../include
52         mkdir -p $(WORKDIR)/../../lib/linux_arm
53         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../include
54         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/linux_arm
55
56 .PHONY: linux_nanox
57 linux_nanox:
58         cd $(WORKDIR)/fltk-1.3.4-1; \
59         make clean; \
60         ./configure CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32 -static-libgcc -static-libstdc++" --enable-static --x-includes=../../../../include/  --x-libraries=../../../../lib/linux32 --enable-localjpeg --enable-localzlib --enable-localpng --disable-gl --disable-xinerama --disable-xft --disable-xdbe --disable-xfixes --disable-xcursor --disable-xrender; \
61         sed -i -e 's/-lX11/-lNX11 -lnano-X/g' ./makeinclude; \
62         sed -i -e 's/-lX11/-lNX11 -lnano-X/g' ./fltk-config; \
63         sed -i -e '/#define USE_XRANDR/ a #undef USE_XRANDR' ./src/Fl_x.cxx; \
64         sed -i -e '/#define USE_XRANDR/ a #undef USE_XRANDR' ./src/screen_xywh.cxx; \
65         make -k -j4
66         mkdir -p $(WORKDIR)/../../include
67         mkdir -p $(WORKDIR)/../../lib/linux32
68         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../include
69         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/linux32
70
71 .PHONY: android_arm
72 android_arm:
73         cd $(WORKDIR)/fltk-1.3.4-1; \
74         make clean; \
75         ./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=../../../../include/ --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; \
76         sed -i -e 's/-lX11/-lNX11 -lnano-X/g' ./makeinclude; \
77         sed -i -e 's/-lX11/-lNX11 -lnano-X/g' ./fltk-config; \
78         sed -i -e '/#define USE_XRANDR/ a #undef USE_XRANDR' ./src/Fl_x.cxx; \
79         sed -i -e '/#define USE_XRANDR/ a #undef USE_XRANDR' ./src/screen_xywh.cxx; \
80         sed -i -e 's/char \*pc_dl_error/const char \*pc_dl_error/g' ./src/Fl_Native_File_Chooser_GTK.cxx; \
81         make -i -j4
82         mkdir -p $(WORKDIR)/../../include
83         mkdir -p $(WORKDIR)/../../lib/android_arm
84         cp -rf $(WORKDIR)/fltk-1.3.4-1/FL $(WORKDIR)/../../include
85         cp -rf $(WORKDIR)/fltk-1.3.4-1/lib/*.a $(WORKDIR)/../../lib/android_arm
86
87 .PHONY: clean
88 clean:
89         rm -rf $(WORKDIR)/fltk-1.3.4-1