comparison Makefile @ 68:59edd5780fef

Changed d-box code to run cleanly when built on board. Updated Makefile to add ne10 include path on board. Some extra docs in Utilities.h
author andrewm
date Fri, 17 Jul 2015 16:57:08 +0100
parents b89dd0c97a04
children 272154649c46
comparison
equal deleted inserted replaced
67:472e892c6e41 68:59edd5780fef
7 # and not for cross-compiling 7 # and not for cross-compiling
8 8
9 RM := rm -rf 9 RM := rm -rf
10 STATIC_LIBS := ./libprussdrv.a ./libNE10.a 10 STATIC_LIBS := ./libprussdrv.a ./libNE10.a
11 LIBS := -lrt -lnative -lxenomai 11 LIBS := -lrt -lnative -lxenomai
12
13 INCLUDES := -I/usr/include/ne10 -I/usr/xenomai/include -I/usr/arm-linux-gnueabihf/include/xenomai/include -I/usr/arm-linux-gnueabihf/include/ne10
14
12 15
13 ASM_SRCS := $(wildcard source/*.S) 16 ASM_SRCS := $(wildcard source/*.S)
14 ASM_OBJS := $(addprefix build/source/,$(notdir $(ASM_SRCS:.S=.o))) 17 ASM_OBJS := $(addprefix build/source/,$(notdir $(ASM_SRCS:.S=.o)))
15 ASM_DEPS := $(addprefix build/source/,$(notdir $(ASM_SRCS:.S=.d))) 18 ASM_DEPS := $(addprefix build/source/,$(notdir $(ASM_SRCS:.S=.d)))
16 19
53 # Objects for a system-supplied default main() file, if the user 56 # Objects for a system-supplied default main() file, if the user
54 # only wants to provide the render functions. 57 # only wants to provide the render functions.
55 DEFAULT_MAIN_CPP_SRCS := ./core/default_main.cpp 58 DEFAULT_MAIN_CPP_SRCS := ./core/default_main.cpp
56 DEFAULT_MAIN_OBJS := ./build/core/default_main.o 59 DEFAULT_MAIN_OBJS := ./build/core/default_main.o
57 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d 60 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d
58 61
59 # All = build BeagleRT 62 # All = build BeagleRT
60 all: BeagleRT 63 all: BeagleRT
61 64
62 # Rule for BeagleRT core C++ files 65 # Rule for BeagleRT core C++ files
63 build/core/%.o: ./core/%.cpp 66 build/core/%.o: ./core/%.cpp
64 @echo 'Building file: $<' 67 @echo 'Building file: $<'
65 @echo 'Invoking: GCC C++ Compiler' 68 @echo 'Invoking: GCC C++ Compiler'
66 g++ -I/usr/xenomai/include -I/usr/arm-linux-gnueabihf/include/xenomai/include -I/usr/arm-linux-gnueabihf/include/ne10 -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" 69 g++ $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
67 @echo 'Finished building: $<' 70 @echo 'Finished building: $<'
68 @echo ' ' 71 @echo ' '
69 72
70 # Rule for user-supplied C++ files 73 # Rule for user-supplied C++ files
71 build/source/%.o: ./source/%.cpp 74 build/source/%.o: ./source/%.cpp
72 @echo 'Building file: $<' 75 @echo 'Building file: $<'
73 @echo 'Invoking: GCC C++ Compiler' 76 @echo 'Invoking: GCC C++ Compiler'
74 g++ -I./include -I/usr/xenomai/include -I/usr/arm-linux-gnueabihf/include/xenomai/include -I/usr/arm-linux-gnueabihf/include/ne10 -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" 77 g++ -I./include $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
75 @echo 'Finished building: $<' 78 @echo 'Finished building: $<'
76 @echo ' ' 79 @echo ' '
77 80
78 # Rule for user-supplied C files 81 # Rule for user-supplied C files
79 build/source/%.o: ./source/%.c 82 build/source/%.o: ./source/%.c
80 @echo 'Building file: $<' 83 @echo 'Building file: $<'
81 @echo 'Invoking: GCC C Compiler' 84 @echo 'Invoking: GCC C Compiler'
82 gcc -I./include -I/usr/xenomai/include -I/usr/arm-linux-gnueabihf/include/xenomai/include -I/usr/arm-linux-gnueabihf/include/ne10 -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" 85 gcc -I./include $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
83 @echo 'Finished building: $<' 86 @echo 'Finished building: $<'
84 @echo ' ' 87 @echo ' '
85 88
86 # Rule for user-supplied assembly files 89 # Rule for user-supplied assembly files
87 build/source/%.o: ./source/%.S 90 build/source/%.o: ./source/%.S
88 @echo 'Building file: $<' 91 @echo 'Building file: $<'
89 @echo 'Invoking: GCC Assembler' 92 @echo 'Invoking: GCC Assembler'
90 as -o "$@" "$<" 93 as -o "$@" "$<"
100 $(eval NEXT_TARGET := $(shell bash -c 'if [ `nm build/source/*.o | grep -w T | grep -w main | wc -l` == '0' ]; then echo "BeagleRT_with_main"; else echo "BeagleRT_without_main"; fi')) 103 $(eval NEXT_TARGET := $(shell bash -c 'if [ `nm build/source/*.o | grep -w T | grep -w main | wc -l` == '0' ]; then echo "BeagleRT_with_main"; else echo "BeagleRT_without_main"; fi'))
101 $(MAKE) $(NEXT_TARGET) 104 $(MAKE) $(NEXT_TARGET)
102 @echo 'Finished building target: $@' 105 @echo 'Finished building target: $@'
103 @echo ' ' 106 @echo ' '
104 # $(MAKE) --no-print-directory post-build 107 # $(MAKE) --no-print-directory post-build
105 108
106 # Rule for building BeagleRT including the default main file (no user-supplied main()) 109 # Rule for building BeagleRT including the default main file (no user-supplied main())
107 BeagleRT_with_main: $(CORE_OBJS) $(DEFAULT_MAIN_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) 110 BeagleRT_with_main: $(CORE_OBJS) $(DEFAULT_MAIN_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS)
108 @echo 'Building target: $@' 111 @echo 'Building target: $@'
109 @echo 'Invoking: GCC C++ Linker' 112 @echo 'Invoking: GCC C++ Linker'
110 g++ -L/usr/xenomai/lib -L/usr/arm-linux-gnueabihf/lib -L/usr/arm-linux-gnueabihf/lib/xenomai -L/usr/lib/arm-linux-gnueabihf -pthread -Wpointer-arith -o "BeagleRT" $(CORE_OBJS) $(DEFAULT_MAIN_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS) 113 g++ -L/usr/xenomai/lib -L/usr/arm-linux-gnueabihf/lib -L/usr/arm-linux-gnueabihf/lib/xenomai -L/usr/lib/arm-linux-gnueabihf -pthread -Wpointer-arith -o "BeagleRT" $(CORE_OBJS) $(DEFAULT_MAIN_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS)