]> git.vomp.tv Git - vompclient.git/blob - GNUmakefile
Cross compiling... So close
[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 # valid platforms are raspberry and crossraspberry
9 vomp_platform=$(shell ./select-platform)
10 $(info selected $(vomp_platform))
11
12 # uncomment the line below if you want to build vomp application without a reboot option, automatically set for windows!
13 #vomp_options+= -DVOMP_HAS_EXIT
14
15 CROSSROOT=
16
17 ifndef VERBOSE
18 Q = @
19 endif
20
21 # Pictures for linux builds
22 PICTURES = -Wl,--format=binary
23 PICTURES += -Wl,other/vdrhires.png
24 PICTURES += -Wl,other/wallpaper720p.jpg
25 PICTURES += -Wl,other/properties.png
26 PICTURES += -Wl,other/radio.png
27 PICTURES += -Wl,other/timers.png
28 PICTURES += -Wl,other/tv.png
29 PICTURES += -Wl,other/recordings.png
30 PICTURES += -Wl,other/restart.png
31 PICTURES += -Wl,other/hd1080i.png
32 PICTURES += -Wl,other/hd720p.png
33 PICTURES += -Wl,other/sd576i.png
34 PICTURES += -Wl,other/txtoff.png
35 PICTURES += -Wl,other/txton.png
36 PICTURES += -Wl,other/dolbyoff.png
37 PICTURES += -Wl,other/dolbyon.png
38 PICTURES += -Wl,other/recording.png
39 PICTURES += -Wl,other/recfolder.png
40 PICTURES += -Wl,other/defposter.png
41 PICTURES += -Wl,--format=default
42
43 ifeq ($(vomp_platform),raspberry)
44 $(info Raspberry Pi native compiler)
45 CC=clang-9
46 STRIP=strip
47 CXX=clang++-9
48 LD=clang++-9
49 vomp_options += -DIPV6
50 LDFLAGS = -fuse-ld=gold $(PICTURES)
51 LIBPATHS = -L/opt/vc/lib -L/usr/lib/arm-linux-gnueabihf
52 LIBS = -lpthread -lrt -lbrcmEGL -lbrcmOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil -lavresample
53 LIBS += -ldl -lfontconfig -lfreetype -lMagick++-6.Q16
54 OBJECTS = $(OBJ_COMMON) $(OBJ_RASPBERRY)
55 CROSSLIBS =
56 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
57 PLATFORM = -DVOMP_PLATFORM_RASPBERRY
58 CXXFLAGS_EXTRA =
59 endif
60
61 ifeq ($(vomp_platform),crossraspberry)
62 $(info Raspberry Pi cross compiler)
63 CC=arm-linux-gnueabihf-gcc
64 STRIP=arm-linux-gnueabihf-strip
65 CXX=arm-linux-gnueabihf-g++
66 LD=arm-linux-gnueabihf-g++
67 LDFLAGS = $(PICTURES) -Xlinker --sysroot=$(CROSSROOT) -Xlinker --rpath-link=$(CROSSROOT)/usr/lib/gcc/arm-linux-gnueabihf/8 -Xlinker --rpath-link=$(CROSSROOT)/usr/lib/arm-linux-gnueabihf -Xlinker --rpath-link=$(CROSSROOT)/lib/arm-linux-gnueabihf -Xlinker --rpath-link=$(CROSSROOT)/opt/vc/lib
68 LIBPATHS = -L$(CROSSROOT)/usr/lib/gcc/arm-linux-gnueabihf/8 -L$(CROSSROOT)/opt/vc/lib -L$(CROSSROOT)/lib -L$(CROSSROOT)/usr/lib -L$(CROSSROOT)/lib/arm-linux-gnueabihf -L$(CROSSROOT)/usr/lib/arm-linux-gnueabihf -L$(CROSSROOT)/usr/local/lib
69 LIBS = -lpthread -lrt -lbrcmEGL -lbrcmOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil -lavresample
70 LIBS += -ldl -lfontconfig -lfreetype -lMagick++-6.Q16 -lm
71 OBJECTS = $(OBJ_COMMON) $(OBJ_RASPBERRY)
72 CROSSLIBS =
73 INCLUDES = -I$(CROSSROOT)/opt/vc/include -I$(CROSSROOT)/opt/vc/include/interface/vcos/pthreads -I$(CROSSROOT)/usr/include -I$(CROSSROOT)/usr/include/arm-linux-gnueabihf -I$(CROSSROOT)/usr/include/freetype2 -I$(CROSSROOT)/usr/include/ImageMagick-6  -I$(CROSSROOT)/usr/include/ImageMagick  -I$(CROSSROOT)/usr/include/arm-linux-gnueabihf/ImageMagick-6
74 PLATFORM = -DVOMP_PLATFORM_RASPBERRY
75 CXXFLAGS_EXTRA = -mfloat-abi=hard
76 endif
77
78 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 $(PLATFORM) $(vomp_options) $(INCLUDES)
79 CXXFLAGS_REL = -O3 -Wall -Werror -std=c++14 $(CXXFLAGS_EXTRA) -D_GNU_SOURCE $(PLATFORM) $(vomp_options) $(INCLUDES)
80
81 .PHONY: clean fresh all install strip
82
83 default: dev
84 fresh:   clean default
85
86 %.o: %.cc
87         @echo CC $@
88         $(Q)$(CXX) $(CXXFLAGS) -c -o $@ $<
89
90 vompclient: $(OBJECTS) $(CROSSLIBS)
91         @echo LD vompclient
92         $(Q)$(LD) $(LDFLAGS) $(LIBPATHS) -o vompclient $(OBJECTS) $(CROSSLIBS) $(LIBS)
93
94 strip:
95         @echo STRIP vompclient
96         $(Q)$(STRIP) vompclient
97
98 dev: CXXFLAGS := $(CXXFLAGS_DEV)
99 dev: vompclient
100
101 release: CXXFLAGS := $(CXXFLAGS_REL)
102 release: clean vompclient strip
103
104 clean:
105         rm -f *.o deps vompclient *~ fonts/*.o fonts/*~ teletxt/*.o
106
107 ifndef SKIPDEPS
108 deps: GNUmakefile
109         @echo "DEPS"
110         $(Q)$(CC) -MM $(INCLUDES) $(OBJECTS:%.o=%.cc) > deps
111 endif
112
113 ifneq ($(MAKECMDGOALS),clean)
114 include deps
115 endif