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