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