-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
199 lines (153 loc) · 6.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# ============================================================================
# Name : Makefile
# Since : 22/4/2011
# Author : Alberto Realis-Luc <[email protected]>
# Web : http://www.alus.it/airnavigator/
# Copyright : (C) 2010-2015 Alberto Realis-Luc
# License : GNU GPL v2
# Repository : https://github.com/AirNavigator/AirNavigator.git
# Last change : 21/2/2016
# Description : Makefile of AirNavigator for TomTom devices
# ============================================================================
# AirNavigator version string
VERSION = 0.3.2
# Toolchain path
TOOLCHAIN_PATH = /usr/local/cross/gcc-3.3.4_glibc-2.3.2/bin
# Add toolchain location to the path
export PATH := $(TOOLCHAIN_PATH):$(PATH)
# Compiler and tools
CC = arm-linux-gcc
STRIP = arm-linux-strip
# Compiler and linker options
WARN_CFLAGS = -std=gnu99 -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wno-unused-parameter -Werror
CFLAGS = -c -O3 -fPIC -mcpu=arm920t $(WARN_CFLAGS)
LFLAGS = -lm -lpthread
# Source and binary paths
SRC = src/
BIN = bin/
# Libs sources and libs headers path
LIBSRC = libs/
# Headers for others external libs path (TomTom stuff)
INC = include/
# List of C source files
CFILES = \
AirCalc.c \
BlackBox.c \
Common.c \
Configuration.c \
Ephemerides.c \
FBrender.c \
Geoidal.c \
GPSreceiver.c \
HSI.c \
main.c \
Navigator.c \
NMEAparser.c \
TSreader.c
# SiRFparser.c \
# List of object files
OBJS = $(patsubst %.c, $(BIN)%.o, $(CFILES))
# Final distribution destination folder
DIST = release/
# Libraries destination path
LIB = $(DIST)AirNavigator/lib/
# List of libraries
LIBFILES = libroxml.so
LIBS= $(patsubst %.so, $(LIB)%.so, $(LIBFILES))
# Path of mounted TomTom device disk
DEVICE = /media/INTERNAL/
# Name of the ditributions zip files
ZIPNAME = AirNavigator_$(subst .,-,$(VERSION))
ZIPSTANDNAME = AirNavigatorStandalone_$(subst .,-,$(VERSION))
# Path of the ttsystem image file
SYSTEMIMAGE = utility/standaloneImage/
### Build dependencies
all: $(DIST)AirNavigator/AirNavigator
$(DIST)AirNavigator/AirNavigator: $(OBJS) $(LIBS)
@echo Linking all into: $@
@$(CC) $(LFLAGS) $(OBJS) -L$(LIB) -lroxml -o $@
@$(STRIP) $@
# Create bin directory if missing
$(OBJS): | $(BIN)
$(BIN):
mkdir -p $(BIN)
# Create lib directory if missing
$(LIBS): | $(LIB)
$(LIB):
mkdir -p $(LIB)
$(BIN)main.o: $(SRC)main.c $(SRC)Common.h $(SRC)Configuration.h $(SRC)FBrender.h $(SRC)TSreader.h $(SRC)GPSreceiver.h $(SRC)Navigator.h $(SRC)AirCalc.h $(SRC)BlackBox.h $(SRC)HSI.h $(SRC)Geoidal.h
@echo Compiling: $<
@$(CC) $(CFLAGS) -D'VERSION="$(VERSION)"' -I $(INC) $< -o $@
$(BIN)GPSreceiver.o: $(SRC)GPSreceiver.c $(SRC)GPSreceiver.h $(SRC)NMEAparser.h $(SRC)SiRFparser.h $(SRC)Common.h $(SRC)Configuration.h $(SRC)AirCalc.h $(SRC)Geoidal.h $(SRC)FBrender.h $(SRC)HSI.h $(SRC)BlackBox.h
@echo Compiling: $<
@$(CC) $(CFLAGS) -I $(INC) $< -o $@
$(BIN)NMEAparser.o: $(SRC)NMEAparser.c $(SRC)NMEAparser.h $(SRC)GPSreceiver.h $(SRC)Common.h $(SRC)AirCalc.h $(SRC)Geoidal.h $(SRC)FBrender.h $(SRC)HSI.h $(SRC)Navigator.h $(SRC)BlackBox.h
@echo Compiling: $<
@$(CC) $(CFLAGS) $< -o $@
$(BIN)SiRFparser.o: $(SRC)SiRFparser.c $(SRC)SiRFparser.h $(SRC)GPSreceiver.h $(SRC)Common.h
@echo Compiling: $<
@$(CC) $(CFLAGS) $< -o $@
$(BIN)Navigator.o: $(SRC)Navigator.c $(SRC)Navigator.h $(SRC)Configuration.h $(SRC)AirCalc.h $(SRC)GPSreceiver.h $(SRC)FBrender.h $(SRC)HSI.h $(SRC)Ephemerides.h $(SRC)Common.h $(LIBSRC)libroxml/roxml.h
@echo Compiling: $<
@$(CC) $(CFLAGS) -I $(LIBSRC) $< -o $@
$(BIN)HSI.o: $(SRC)HSI.c $(SRC)HSI.h $(SRC)FBrender.h $(SRC)AirCalc.h $(SRC)Configuration.h
@echo Compiling: $<
@$(CC) $(CFLAGS) $< -o $@
$(BIN)BlackBox.o: $(SRC)BlackBox.c $(SRC)BlackBox.h $(SRC)Common.h $(SRC)Configuration.h $(SRC)AirCalc.h
@echo Compiling: $<
@$(CC) $(CFLAGS) $< -o $@
$(BIN)FBrender.o: $(SRC)FBrender.c $(SRC)FBrender.h $(SRC)Navigator.h $(SRC)AirCalc.h $(SRC)GPSreceiver.h $(SRC)Configuration.h
@echo Compiling: $<
@$(CC) $(CFLAGS) -DLINUX_TARGET -I $(INC) $< -o $@
$(BIN)Configuration.o: $(SRC)Configuration.c $(SRC)Configuration.h $(SRC)Common.h $(SRC)AirCalc.h $(SRC)FBrender.h $(LIBSRC)libroxml/roxml.h
@echo Compiling: $<
@$(CC) $(CFLAGS) -I $(LIBSRC) $< -o $@
$(BIN)Geoidal.o: $(SRC)Geoidal.c $(SRC)Geoidal.h $(SRC)Common.h
@echo Compiling: $<
@$(CC) $(CFLAGS) $< -o $@
$(BIN)TSreader.o: $(SRC)TSreader.c $(SRC)TSreader.h $(SRC)Common.h
@echo Compiling: $<
@$(CC) $(CFLAGS) -I $(INC) $< -o $@
$(BIN)Ephemerides.o: $(SRC)Ephemerides.c $(SRC)Ephemerides.h $(SRC)AirCalc.h $(SRC)Common.h
@echo Compiling: $<
@$(CC) $(CFLAGS) $< -o $@
$(BIN)AirCalc.o: $(SRC)AirCalc.c $(SRC)AirCalc.h $(SRC)Common.h
@echo Compiling: $<
@$(CC) $(CFLAGS) $< -o $@
$(BIN)Common.o: $(SRC)Common.c $(SRC)Common.h
@echo Compiling: $<
@$(CC) $(CFLAGS) $< -o $@
### Lib dependencies
$(LIB)libroxml.so: $(LIBSRC)libroxml/Makefile
@echo Building library: $@
@make -C $(LIBSRC)libroxml
@cp -f $(LIBSRC)libroxml/libroxml.so $@
### Clean dependencies
clean: objclean libclean
# To clean just objects, executable and zip file
objclean:
@echo Cleaning: objects, executable and distribution files
@rm -f $(BIN)*
@rm -f $(DIST)AirNavigator/AirNavigator
@rm -f $(DIST)*.zip
# To clean just the libraries
libclean:
@echo Cleaning: libraries and libraries object files
@make -C $(LIBSRC)libroxml clean
@rm -f $(LIB)*
### Upload just the executable on the TomTom
upload: all
@echo Uploading new executable on the TomTom
@cp -f $(DIST)AirNavigator/AirNavigator $(DEVICE)AirNavigator/
### Make the zip files with the final distribution normal and standalone
zip: all $(SYSTEMIMAGE)ttsystem $(SYSTEMIMAGE)config.xml
@echo Creating distributions zip files
@rm -f $(DIST)*.zip
@mkdir -p $(DIST)AirNavigator/Tracks
cd $(DIST); zip -9 -T -x "*.git*" "*.svn*" -r $(ZIPNAME).zip . ; cd ..;
@cp $(SYSTEMIMAGE)ttsystem $(DIST)
@mv $(DIST)AirNavigator/config.xml $(DIST)
@cp $(SYSTEMIMAGE)config.xml $(DIST)AirNavigator/
cd $(DIST); zip -9 -T -x "*.git*" "*.svn*" -r $(ZIPSTANDNAME).zip ttsystem AirNavigator/* README.txt ; cd ..;
@rm $(DIST)ttsystem
@mv -f $(DIST)config.xml $(DIST)AirNavigator/