LP-500 HoTT Telemetry added device definitions
[librepilot.git] / make / functions.mk
blobff54375cf25f0723de07deeb343491bd55e9c004
2 # Copyright (C) 2015, The LibrePilot Team, http://www.librepilot.org
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # for more details.
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # Make sure we know few things about the architecture before including
20 # the tools.mk to ensure that we download/install the right tools.
21 UNAME := $(shell uname)
22 # Here and everywhere if not Linux or Mac then assume Windows
23 ifeq ($(filter Linux Darwin, $(UNAME)), )
24 UNAME := Windows
25 CC := gcc# because cc doesn't exist
26 endif
28 ifeq ($(UNAME),Windows)
29 system_path = $(shell cygpath -w $(1))
30 else
31 system_path = $(1)
32 endif
34 # Function for converting Windows style slashes into Unix style
35 slashfix = $(subst \,/,$(1))
37 # Function for converting an absolute path to one relative
38 # to the top of the source tree
39 toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
41 # Function to convert to all lowercase
42 lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
44 # Function to make all lowercase and replace spaces with -
45 EMPTY :=
46 SPACE := $(EMPTY) $(EMPTY)
47 define NEWLINE :=
50 endef
52 smallify = $(subst $(SPACE),-,$(call lc,$1))
54 get_arch = $(shell $(CC) -dumpmachine | sed s/-.*//)