]> git.vomp.tv Git - vompclient.git/blob - GNUmakefile
Fully working cross compilation
[vompclient.git] / GNUmakefile
1 # Switches for this Makefile:
2
3 # VERBOSE - set to 1 to show all commands
4 # SKIPDEPS - Skip regeneration of dependencies file
5
6 include objects.mk
7
8 vomp_platform=$(shell ./select-platform)
9 # vomp_platform variable sets up the build on different platforms
10 # valid platforms are:
11 # raspberry - native compile for & on Raspberry Pi
12 # crossraspberry - cross compile for Raspberry Pi
13 # Override auto select here:
14 # vomp_platform=
15
16 $(info Build system selected: $(vomp_platform))
17
18
19 # uncomment the line below if you want to build vomp application without a reboot option, automatically set for windows!
20 #VOMP_OPTIONS+= -DVOMP_HAS_EXIT
21
22 CROSSROOT=/pi-root
23
24 ifndef VERBOSE
25 Q = @
26 endif
27
28 # Pictures for linux builds
29 PICTURES = -Wl,--format=binary
30 PICTURES += -Wl,other/vdrhires.png
31 PICTURES += -Wl,other/wallpaper720p.jpg
32 PICTURES += -Wl,other/properties.png
33 PICTURES += -Wl,other/radio.png
34 PICTURES += -Wl,other/timers.png
35 PICTURES += -Wl,other/tv.png
36 PICTURES += -Wl,other/recordings.png
37 PICTURES += -Wl,other/restart.png
38 PICTURES += -Wl,other/hd1080i.png
39 PICTURES += -Wl,other/hd720p.png
40 PICTURES += -Wl,other/sd576i.png
41 PICTURES += -Wl,other/txtoff.png
42 PICTURES += -Wl,other/txton.png
43 PICTURES += -Wl,other/dolbyoff.png
44 PICTURES += -Wl,other/dolbyon.png
45 PICTURES += -Wl,other/recording.png
46 PICTURES += -Wl,other/recfolder.png
47 PICTURES += -Wl,other/defposter.png
48 PICTURES += -Wl,--format=default
49
50 ifeq ($(vomp_platform),raspberry)
51 $(info Raspberry Pi native compiler)
52 CC=gcc
53 STRIP=strip
54 CXX=g++
55 LD=g++
56
57 #CC=clang-9
58 #STRIP=strip
59 #CXX=clang++-9
60 #LD=clang++-9
61
62 LDFLAGS = -fuse-ld=gold $(PICTURES)
63 #-fuse-ld=gold
64
65 VOMP_OPTIONS += -DIPV4 -DIPV6
66 LIBPATHS = -L/opt/vc/lib -L/usr/lib/arm-linux-gnueabihf
67 LIBS = -lpthread -lrt -lbrcmEGL -lbrcmOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil -lswresample
68 LIBS += -ldl -lfontconfig -lfreetype -lMagick++-6.Q16
69 OBJECTS = $(OBJ_COMMON) $(OBJ_RASPBERRY)
70 INCLUDES = -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/usr/include/freetype2 -I/usr/include/ImageMagick -I/usr/include/ImageMagick-6 -I/usr/include/arm-linux-gnueabihf/ImageMagick-6
71 PLATFORM = -DVOMP_PLATFORM_RASPBERRY
72 CXXFLAGS_EXTRA = -Wno-psabi
73 endif
74
75
76
77 # Debian 10 x64
78 # apt install g++-arm-linux-gnueabihf
79 # Set vomp_platform=crossraspberry above
80 ifeq ($(vomp_platform),crossraspberry)
81 VOMP_OPTIONS += -DIPV4 -DIPV6
82 CROSS_PREFIX=arm-linux-gnueabihf-
83 CC=$(CROSS_PREFIX)gcc
84 STRIP=$(CROSS_PREFIX)strip
85 CXX=$(CROSS_PREFIX)g++
86 LD=$(CROSS_PREFIX)g++
87
88 LDFLAGS = -Wall $(PICTURES) --sysroot=$(CROSSROOT) \
89  -Wl,-rpath-link,$(CROSSROOT)/opt/vc/lib -Wl,-rpath-link,$(CROSSROOT)/usr/lib/arm-linux-gnueabihf \
90  -L=/opt/vc/lib -L=/usr/lib/arm-linux-gnueabihf
91 LIBPATHS =
92 LIBS = -lpthread -lstdc++ -lrt -lbrcmEGL -lbrcmOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec \
93  -lavutil -lswresample -lm -ldl -lfontconfig -lfreetype -lMagick++-6.Q16 -lMagickWand-6.Q16 -lMagickCore-6.Q16
94 OBJECTS = $(OBJ_COMMON) $(OBJ_RASPBERRY)
95 INCLUDES = --sysroot=$(CROSSROOT) -I=/usr/include/arm-linux-gnueabihf -I=/opt/vc/include -I=/usr/include/freetype2 -I=/usr/include/arm-linux-gnueabihf/ImageMagick-6 -I=/usr/include/ImageMagick-6
96 PLATFORM = -DVOMP_PLATFORM_RASPBERRY
97 CXXFLAGS_EXTRA = -mtune=cortex-a7 -mfloat-abi=hard -fopenmp
98 endif
99
100 CXXFLAGS_DEV = -g -O0 -Wall -Wextra -Wshadow -Werror=return-type -Wmissing-declarations -Winit-self -Woverloaded-virtual -Wold-style-cast -Wconversion -std=c++14 $(CXXFLAGS_EXTRA) -DDEV -D_GNU_SOURCE -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 $(PLATFORM) $(VOMP_OPTIONS) $(INCLUDES)
101 CXXFLAGS_REL = -O3 -Wall -Werror -std=c++14 $(CXXFLAGS_EXTRA) -D_GNU_SOURCE -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 $(PLATFORM) $(VOMP_OPTIONS) $(INCLUDES)
102
103
104
105 .PHONY: clean fresh all install strip
106
107 default: dev
108 fresh:   clean default
109
110 %.o: %.cc
111         @echo CC $@
112         $(Q)$(CXX) $(CXXFLAGS) -c -o $@ $<
113
114 vompclient: $(OBJECTS)
115         @echo LD vompclient
116         $(Q)$(LD) $(LDFLAGS) $(LIBPATHS) -o vompclient $(OBJECTS) $(LIBS)
117
118 strip:
119         @echo STRIP vompclient
120         $(Q)$(STRIP) vompclient
121
122 dev: CXXFLAGS := $(CXXFLAGS_DEV)
123 dev: vompclient
124
125 release: CXXFLAGS := $(CXXFLAGS_REL)
126 release: clean vompclient strip
127
128 clean:
129         rm -f *.o deps vompclient *~ fonts/*.o fonts/*~ teletxt/*.o
130
131 ifndef SKIPDEPS
132 deps: GNUmakefile
133         @echo "DEPS"
134         $(Q)$(CC) -MM $(INCLUDES) $(OBJECTS:%.o=%.cc) > deps
135 endif
136
137 ifneq ($(MAKECMDGOALS),clean)
138 include deps
139 endif