comparison Makefile @ 69:272154649c46

Changes to Makefile to support syntax checking
author andrewm
date Fri, 17 Jul 2015 17:41:35 +0100
parents 59edd5780fef
children f3251851c718
comparison
equal deleted inserted replaced
68:59edd5780fef 69:272154649c46
58 DEFAULT_MAIN_CPP_SRCS := ./core/default_main.cpp 58 DEFAULT_MAIN_CPP_SRCS := ./core/default_main.cpp
59 DEFAULT_MAIN_OBJS := ./build/core/default_main.o 59 DEFAULT_MAIN_OBJS := ./build/core/default_main.o
60 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d 60 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d
61 61
62 # All = build BeagleRT 62 # All = build BeagleRT
63 all: SYNTAX_FLAG :=
63 all: BeagleRT 64 all: BeagleRT
65
66 # syntax = check syntax
67 syntax: SYNTAX_FLAG := -fsyntax-only
68 syntax: BeagleRT
64 69
65 # Rule for BeagleRT core C++ files 70 # Rule for BeagleRT core C++ files
66 build/core/%.o: ./core/%.cpp 71 build/core/%.o: ./core/%.cpp
67 @echo 'Building file: $<' 72 @echo 'Building file: $<'
68 @echo 'Invoking: GCC C++ Compiler' 73 @echo 'Invoking: GCC C++ Compiler'
69 g++ $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" 74 g++ $(SYNTAX_FLAG) $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
70 @echo 'Finished building: $<' 75 @echo 'Finished building: $<'
71 @echo ' ' 76 @echo ' '
72 77
73 # Rule for user-supplied C++ files 78 # Rule for user-supplied C++ files
74 build/source/%.o: ./source/%.cpp 79 build/source/%.o: ./source/%.cpp
75 @echo 'Building file: $<' 80 @echo 'Building file: $<'
76 @echo 'Invoking: GCC C++ Compiler' 81 @echo 'Invoking: GCC C++ Compiler'
77 g++ -I./include $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" 82 g++ $(SYNTAX_FLAG) -I./include $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
78 @echo 'Finished building: $<' 83 @echo 'Finished building: $<'
79 @echo ' ' 84 @echo ' '
80 85
81 # Rule for user-supplied C files 86 # Rule for user-supplied C files
82 build/source/%.o: ./source/%.c 87 build/source/%.o: ./source/%.c
83 @echo 'Building file: $<' 88 @echo 'Building file: $<'
84 @echo 'Invoking: GCC C Compiler' 89 @echo 'Invoking: GCC C Compiler'
85 gcc -I./include $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" 90 gcc $(SYNTAX_FLAG) -I./include $(INCLUDES) -O2 -Wall -c -fmessage-length=0 -U_FORTIFY_SOURCE -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
86 @echo 'Finished building: $<' 91 @echo 'Finished building: $<'
87 @echo ' ' 92 @echo ' '
88 93
89 # Rule for user-supplied assembly files 94 # Rule for user-supplied assembly files
90 build/source/%.o: ./source/%.S 95 build/source/%.o: ./source/%.S
108 113
109 # Rule for building BeagleRT including the default main file (no user-supplied main()) 114 # Rule for building BeagleRT including the default main file (no user-supplied main())
110 BeagleRT_with_main: $(CORE_OBJS) $(DEFAULT_MAIN_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) 115 BeagleRT_with_main: $(CORE_OBJS) $(DEFAULT_MAIN_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS)
111 @echo 'Building target: $@' 116 @echo 'Building target: $@'
112 @echo 'Invoking: GCC C++ Linker' 117 @echo 'Invoking: GCC C++ Linker'
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) 118 g++ $(SYNTAX_FLAG) -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)
114 119
115 # Rule for building BeagleRT without the default main file (user-supplied main()) 120 # Rule for building BeagleRT without the default main file (user-supplied main())
116 BeagleRT_without_main: $(CORE_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) 121 BeagleRT_without_main: $(CORE_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS)
117 @echo 'Building target: $@' 122 @echo 'Building target: $@'
118 @echo 'Invoking: GCC C++ Linker' 123 @echo 'Invoking: GCC C++ Linker'
119 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) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS) 124 g++ $(SYNTAX_FLAG) -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) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS)
120 125
121 # Other Targets: 126 # Other Targets:
122 127
123 # Remove the temporary user-supplied source, plus the objects built from them 128 # Remove the temporary user-supplied source, plus the objects built from them
124 sourceclean: 129 sourceclean: