]> git.vomp.tv Git - vompclient.git/blob - GNUmakefile
Fully working cross compilation. Change default target from mvp to crossraspberry
[vompclient.git] / GNUmakefile
1 vomp_platform=$(shell ./select-platform)
2 # vomp_platform variable sets up the build on different platforms
3 # valid platforms are:
4 # mvp - cross compile for MVP
5 # raspberry - native compile for & on Raspberry Pi
6 # crossraspberry - cross compile for Raspberry Pi
7 # Override auto select here:
8 # vomp_platform=
9
10 $(info Build system selected: $(vomp_platform))
11
12 vomp_options=
13 # uncomment the line below if you want to build vomp application without a reboot option, automatically set for windows!
14 #vomp_options+= -DVOMP_HAS_EXIT
15
16
17 ifeq ($(vomp_platform),mvp)
18 include ../crosstool/cross-var
19 CC=$(CROSS)gcc
20 STRIP=$(CROSS)strip
21 CXX=$(CROSS)g++
22 LD=$(CROSS)g++
23 endif
24
25 ifeq ($(vomp_platform),raspberry)
26 CC=gcc
27 STRIP=strip
28 CXX=g++
29 LD=g++
30 vomp_options += -DIPV6
31 endif
32
33 # Debian 10 x64
34 # apt install g++-arm-linux-gnueabihf
35 # Set vomp_platform=crossraspberry above
36 ifeq ($(vomp_platform),crossraspberry)
37 CROSS_PREFIX=arm-linux-gnueabihf-
38 CC=$(CROSS_PREFIX)gcc
39 STRIP=$(CROSS_PREFIX)strip
40 CXX=$(CROSS_PREFIX)g++
41 LD=$(CROSS_PREFIX)g++
42 endif
43
44
45 CXXFLAGS_DEV = -g -O0 -Wall -Wshadow -Wno-psabi -DDEV -D_GNU_SOURCE $(INCLUDES) $(vomp_options)
46 CXXFLAGS_REL = -O3 -Wall -Wshadow -D_GNU_SOURCE $(INCLUDES) $(vomp_options)
47 LIBPATHS =
48
49
50 # This is the only thing windows and linux share
51 include objects.mk
52 OBJECTSWIN = threadwin.o remotewin.o ledwin.o mtdwin.o videowin.o audiowin.o osdwin.o surfacewin.o
53 OBJECTS = $(OBJECTS1) 
54
55 # Pictures for linux builds 
56 PICTURES = -Wl,--format=binary 
57 PICTURES += -Wl,other/vdrhires.png 
58 PICTURES += -Wl,other/wallpaper720p.jpg 
59 PICTURES += -Wl,other/properties.png 
60 PICTURES += -Wl,other/radio.png 
61 PICTURES += -Wl,other/timers.png 
62 PICTURES += -Wl,other/tv.png 
63 PICTURES += -Wl,other/recordings.png
64 PICTURES += -Wl,other/restart.png 
65 PICTURES += -Wl,other/hd1080i.png  
66 PICTURES += -Wl,other/hd720p.png   
67 PICTURES += -Wl,other/sd576i.png  
68 PICTURES += -Wl,other/txtoff.png  
69 PICTURES += -Wl,other/txton.png 
70 PICTURES += -Wl,other/dolbyoff.png
71 PICTURES += -Wl,other/dolbyon.png  
72 PICTURES += -Wl,other/recording.png
73 PICTURES += -Wl,other/recfolder.png  
74 PICTURES += -Wl,other/defposter.png  
75 PICTURES += -Wl,--format=default 
76
77
78
79
80 ifeq ($(vomp_platform),mvp)
81 LDFLAGS = -Wall -static
82 LIBS = -lpthread -lrt
83 OBJECTS += wwss.o main.o threadp.o remotemvp.o ledmvp.o mtdmvp.o videomvp.o audiomvp.o osdmvp.o \
84            surfacemvp.o fonts/helvB24.o fonts/helvB18.o wjpegcomplex.o vmedialist.o vcolourtuner.o \
85            audioplayer.o demuxeraudio.o \
86            vmediaview.o vvideomedia.o imagereader.o  media.o  mediaoptions.o mediaplayer.o  serialize.o \
87            localmediafile.o playermedia.o demuxermedia.o mediafile.o osdvector.o surfacevector.o
88 TIOBJECT = ticonfig.o
89 CROSSLIBS = ../jpeg/jpeg-6b/libjpeg.a
90 INCLUDES = -I../jpeg/jpeg-6b  -DVOMP_PLATTFORM_MVP 
91 endif
92
93
94
95 ifeq ($(vomp_platform),raspberry)
96 LDFLAGS = -Wall $(PICTURES)
97 LIBS = -L/opt/vc/lib -lpthread -lrt -lbrcmEGL -lbrcmOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil -lavresample
98 OBJECTS += main.o threadp.o  osdvector.o surfacevector.o osdopenvg.o ledraspberry.o mtdraspberry.o videoomx.o audioomx.o imageomx.o wjpegsimple.o remotelinux.o signal.o 
99 LIBS+= -ldl -lfontconfig -lfreetype -L/usr/lib/arm-linux-gnueabihf -lMagick++-6.Q16 
100 CROSSLIBS = 
101 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
102 CXXFLAGS_DEV += -DVOMP_PLATTFORM_RASPBERRY -D__STDC_CONSTANT_MACROS
103 CXXFLAGS_REL += -DVOMP_PLATTFORM_RASPBERRY -D__STDC_CONSTANT_MACROS
104 endif
105
106
107
108 ifeq ($(vomp_platform),crossraspberry)
109 LDFLAGS = -Wall $(PICTURES) --sysroot=/pi-root \
110  -Wl,-rpath-link,/pi-root/opt/vc/lib -Wl,-rpath-link,/pi-root/usr/lib/arm-linux-gnueabihf \
111  -L=/opt/vc/lib -L=/usr/lib/arm-linux-gnueabihf
112 LIBS = -lpthread -lstdc++ -lrt -lbrcmEGL -lbrcmOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec \
113  -lavutil -lavresample -lm -ldl -lfontconfig -lfreetype -lMagick++-6.Q16 -lMagickWand-6.Q16 -lMagickCore-6.Q16
114 OBJECTS += main.o threadp.o osdvector.o surfacevector.o osdopenvg.o ledraspberry.o mtdraspberry.o videoomx.o audioomx.o imageomx.o wjpegsimple.o remotelinux.o signal.o
115 CROSSLIBS =
116 INCLUDES = --sysroot=/pi-root -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
117
118 CXXFLAGS_DEV += -DVOMP_PLATTFORM_RASPBERRY -mtune=cortex-a7 -D__STDC_CONSTANT_MACROS -mfloat-abi=hard -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
119 CXXFLAGS_REL += -DVOMP_PLATTFORM_RASPBERRY -D__STDC_CONSTANT_MACROS -mfloat-abi=hard -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16
120 endif
121
122
123
124 .PHONY: clean fresh all install strip
125
126 default: dev
127 fresh:   clean default
128
129 vompclient: $(OBJECTS) $(TIOBJECT) $(CROSSLIBS)
130         $(LD) $(LDFLAGS) $(LIBPATHS) $(RELEASE) $(vomp_options) -o vompclient $(TIOBJECT) $(OBJECTS) $(CROSSLIBS) $(LIBS)
131
132 # A slight hash up
133 ticonfig.o:
134         $(CC) $(CXXFLAGS_REL) -c -o ticonfig.o ticonfig.c
135
136 strip:
137         $(STRIP) vompclient
138
139 install:
140         rm -f target-mvp/vompclient
141         cp vompclient target-mvp/vompclient
142
143 install-wmp:
144         rm -f target-wmvp/vompclient
145         cp vompclient target-wmvp/vompclient
146
147 install-dev:
148         rm -f target-mvp-dev/vompclient
149         cp vompclient target-mvp-dev/vompclient
150
151 debug:
152         ../../gdb/gdb-7.12.1/gdb/gdb target-mvp/vompclient target-mvp/core.*
153
154 debug2:
155         ../../gdb/gdb-7.12.1/gdb/gdb target-mvp-dev/vompclient target-mvp-dev/core.*
156
157 dev: CXXFLAGS := $(CXXFLAGS_DEV)
158 dev: vompclient
159
160 release: CXXFLAGS := $(CXXFLAGS_REL)
161 release: clean vompclient strip
162
163 clean:
164         rm -f *.o deps vompclient *~ fonts/*.o fonts/*~ teletxt/*.o
165
166 deps: GNUmakefile
167         $(CC) -MM $(INCLUDES) $(OBJECTS:%.o=%.cc) > deps
168
169 ifneq ($(MAKECMDGOALS),clean)
170 include deps
171 endif