]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - apps/tidep0084.git/blob - tutorials/generic_sensor_tutorial/tutorial/SensorToCloud/scripts/app.mak
Added Support for Generic Sensor Tutorial which provides instructions on how to add...
[apps/tidep0084.git] / tutorials / generic_sensor_tutorial / tutorial / SensorToCloud / scripts / app.mak
1 #############################################################
2 # @file app.mak
3 #
4 # @brief TIMAC 2.0 Aplication Makefile fragment
5 #
6 # Group: WCS LPC
7 # $Target Devices: Linux: AM335x, Embedded Devices: CC1310, CC1350$
8 #
9 #############################################################
10 # $License: BSD3 2016 $
11 #  
12 #   Copyright (c) 2015, Texas Instruments Incorporated
13 #   All rights reserved.
14 #  
15 #   Redistribution and use in source and binary forms, with or without
16 #   modification, are permitted provided that the following conditions
17 #   are met:
18 #  
19 #   *  Redistributions of source code must retain the above copyright
20 #      notice, this list of conditions and the following disclaimer.
21 #  
22 #   *  Redistributions in binary form must reproduce the above copyright
23 #      notice, this list of conditions and the following disclaimer in the
24 #      documentation and/or other materials provided with the distribution.
25 #  
26 #   *  Neither the name of Texas Instruments Incorporated nor the names of
27 #      its contributors may be used to endorse or promote products derived
28 #      from this software without specific prior written permission.
29 #  
30 #   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31 #   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32 #   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33 #   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
34 #   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35 #   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36 #   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
37 #   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 #   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39 #   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 #   EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 #############################################################
42 # $Release Name: TI-15.4Stack Linux x64 SDK$
43 # $Release Date: July 14, 2016 (2.00.00.30)$
44 #############################################################
46 #========================================
47 #
48 # ===================
49 # Theory of Operation
50 # ===================
51 #
52 # A detailed description is in "front_matter.mak"
53 #
54 #
55 #========================================
56 # Error check
57 #----------------------------------------
58 # Ensure that a NAME is specified..
59 ifeq (x${APP_NAME}x,xx)
60 $(error APP_NAME is not specified)
61 endif
64 #========================================
65 # What is the name of the 'appfile' we are creating
66 # Example, if the APP_NAME=foo, the result could be
67 #    host_foo
68 # or  bbb_foo
69 #
70 APPFILE=${ARCH}_${APP_NAME}
72 #========================================
73 # convert *.c in varous forms into objs/host/*.o
74 #             or objs/bbb/*.o
75
76 # we also need to change "linux/*.c" to "*.c"
77 # and "src/*.c" to just "*.c"
78 # We do this in 2 steps
79 _1_C_SOURCES=${C_SOURCES:linux/%.c=%.c}
80 _2_C_SOURCES=${_1_C_SOURCES:src/%.c=%.c}
81 # Now convert to ".o" files
82 OBJFILES=${_2_C_SOURCES:%.c=${OBJDIR}/%.o}
84 #========================================
85 # if ARCH is specified and is all arches..
87 ifeq (${ARCH},all_arches)
89 # Then build all of the arches
90 _app.all: ${ALL_ARCHES:%=_app.%}
92 # Recursively build each ARCH target.
93 _app.%:
94         ${recursive_MAKE} ARCH=$* _app
96 else
98 # specific arch is specified, so just build the app
99 _app: ${APPFILE}
101 #========================================
102 # Do we have any pre/post link commands?
103 # Supply reasonable defaults ... if not specified.
104 PRE_LINK_CMD  ?= /bin/true
105 POST_LINK_CMD ?= /bin/true
107 # Perform the prelink step
108 _prelink:
109         ${HIDE}${PRE_LINK_CMD}
111 # Do we need any extra libs?
112 # Yes, the host apps are pthread based..
113 EXTRA_APP_LIBS += -lpthread
115 # this builds the "host_foo" or "bbb_foo" app
116 # STEP 1: the OBJECT directory
117 # STEP 2: any generated files
118 # STEP 3: The object files
119 # STEP 4: Any pre-link step
120 # STEP 5: We purposely force the link to occur
121 # STEP 6: We do the POST LINK as part of the rule.
122
123 ${APPFILE}: bbb_compiler_check ${OBJDIR} generated_files ${OBJFILES}   _prelink force 
124         ${HIDE}rm -f $@
125         ${HIDE}echo "Creating App: (${ARCH}) ${APPFILE}"
126         ${HIDE}${GCC_EXE} -g ${ARCH_LDFLAGS} -o $@ ${OBJFILES} ${APP_LIBDIRS:%=-L%} ${APP_LIBS:lib%.a=-l%} ${EXTRA_APP_LIBS}
127         ${HIDE}echo "Done."
128         ${HIDE}${POST_LINK_CMD}
130 # Cleanup...
131 clean::
132         ${HIDE}rm -f ${APPFILE}
135 #========================================
136 # Create a symbol table.
137 _app.sym: ${APPFILE}.sym
139 ${APPFILE}.sym: ${APPFILE} force
140         ${HIDE}rm -f $@
141         ${NM_EXE} -demangle -o $@ $<
143 # cleanup
144 clean::
145         ${HIDE}rm -f ${APPFILE}.sym
147 #========================================
148 # Create a disassembly listing
149 _app.dis: ${APPFILE}.dis 
151 ${APPFILE}.dis: ${APPFILE} force
152         ${HIDE}rm -f $@
153         ${OBJDUMP_EXE} -d -demangle -o $@ $<
155 # cleanup
156 clean::
157         ${HIDE}rm -f ${APPFILE}.dis
159 endif
164 #  ========================================
165 #  Texas Instruments Micro Controller Style
166 #  ========================================
167 #  Local Variables:
168 #  mode: makefile-gmake
169 #  End:
170 #  vim:set  filetype=make