Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
15 | mjames | 1 | ########################################################################################################################## |
2 | # File automatically-generated by tool: [projectgenerator] version: [4.2.0-B44] date: [Wed Jan 31 20:10:54 GMT 2024] |
||
3 | ########################################################################################################################## |
||
4 | |||
5 | # ------------------------------------------------ |
||
6 | # Generic Makefile (based on gcc) |
||
7 | # |
||
8 | # ChangeLog : |
||
9 | # 2017-02-10 - Several enhancements + project update mode |
||
10 | # 2015-07-22 - first version |
||
11 | # ------------------------------------------------ |
||
12 | |||
13 | ###################################### |
||
14 | # target |
||
15 | ###################################### |
||
16 | TARGET = libserial |
||
17 | |||
18 | ###################################### |
||
19 | # building variables |
||
20 | ###################################### |
||
21 | # debug build? |
||
22 | DEBUG = 1 |
||
23 | # optimization |
||
24 | OPT = -Og |
||
25 | |||
26 | |||
27 | ####################################### |
||
28 | # paths |
||
29 | ####################################### |
||
30 | # Build path |
||
31 | BUILD_DIR = build |
||
32 | # Library path |
||
33 | LIB_DIR = lib |
||
34 | |||
35 | ###################################### |
||
36 | # source |
||
37 | ###################################### |
||
38 | # C sources |
||
39 | C_SOURCES = \ |
||
40 | src/serial.c \ |
||
41 | src/serialUtils.c |
||
42 | |||
43 | # ASM sources |
||
44 | ASM_SOURCES = |
||
45 | |||
46 | ####################################### |
||
47 | # binaries |
||
48 | ####################################### |
||
49 | PREFIX = arm-none-eabi- |
||
50 | # The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx) |
||
51 | # either it can be added to the PATH environment variable. |
||
52 | ifdef GCC_PATH |
||
53 | CC = $(GCC_PATH)/$(PREFIX)gcc |
||
54 | AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp |
||
55 | CP = $(GCC_PATH)/$(PREFIX)objcopy |
||
56 | SZ = $(GCC_PATH)/$(PREFIX)size |
||
57 | AR = $(GCC_PATH)/$(PREFIX)ar |
||
58 | else |
||
59 | CC = $(PREFIX)gcc |
||
60 | AS = $(PREFIX)gcc -x assembler-with-cpp |
||
61 | CP = $(PREFIX)objcopy |
||
62 | SZ = $(PREFIX)size |
||
63 | AR = $(PREFIX)ar |
||
64 | endif |
||
65 | HEX = $(CP) -O ihex |
||
66 | BIN = $(CP) -O binary -S |
||
67 | |||
68 | ####################################### |
||
69 | # CFLAGS |
||
70 | ####################################### |
||
71 | # cpu |
||
72 | CPU = -mcpu=cortex-m3 |
||
73 | |||
74 | # fpu |
||
75 | # NONE for Cortex-M0/M0+/M3 |
||
76 | |||
77 | # float-abi |
||
78 | |||
79 | # mcu |
||
80 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI) |
||
81 | |||
82 | STM32HAL = ../stm32libs |
||
83 | |||
84 | # macros for gcc |
||
85 | # AS defines |
||
86 | AS_DEFS = |
||
87 | |||
88 | # C defines |
||
89 | C_DEFS = \ |
||
90 | -DUSE_HAL_DRIVER \ |
||
91 | -DSTM32F103xB |
||
92 | |||
93 | # AS includes |
||
94 | AS_INCLUDES = |
||
95 | |||
96 | # C includes |
||
97 | C_INCLUDES = \ |
||
98 | -IInc \ |
||
99 | -I$(STM32HAL)/Drivers/CMSIS/Device/ST/STM32F1xx/Include \ |
||
100 | -I$(STM32HAL)/Drivers/STM32F1xx_HAL_Driver/Inc \ |
||
101 | -I$(STM32HAL)/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy \ |
||
102 | -I$(STM32HAL)/Drivers/CMSIS/Include \ |
||
103 | -IInc/LibPLX/private \ |
||
104 | -I$(LIBSERIAL)/inc |
||
105 | |||
106 | |||
107 | ####################################################################### |
||
108 | # User libraries |
||
109 | |||
110 | LIBSERIAL=../libSerial |
||
111 | |||
112 | # compile gcc flags |
||
113 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
||
114 | |||
115 | CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections |
||
116 | |||
117 | ifeq ($(DEBUG), 1) |
||
118 | CFLAGS += -g -gdwarf-2 |
||
119 | endif |
||
120 | |||
121 | |||
122 | # Generate dependency information |
||
123 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" |
||
124 | |||
125 | |||
126 | ####################################### |
||
127 | # LDFLAGS |
||
128 | ####################################### |
||
129 | # link script |
||
130 | |||
131 | # libraries |
||
132 | LIBS = -lc -lm -lnosys |
||
133 | LIBDIR = lib |
||
134 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections |
||
135 | |||
136 | # default action: build all |
||
137 | all: $(LIB_DIR)/$(TARGET).a |
||
138 | |||
139 | |||
140 | ####################################### |
||
141 | # build the application |
||
142 | ####################################### |
||
143 | # list of objects |
||
144 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o))) |
||
145 | vpath %.c $(sort $(dir $(C_SOURCES))) |
||
146 | # list of ASM program objects |
||
147 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o))) |
||
148 | vpath %.s $(sort $(dir $(ASM_SOURCES))) |
||
149 | |||
150 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) |
||
151 | @echo "making $@" |
||
152 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@ |
||
153 | |||
154 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR) |
||
155 | $(AS) -c $(CFLAGS) $< -o $@ |
||
156 | |||
157 | $(LIB_DIR)/$(TARGET).a: $(OBJECTS) Makefile | $(LIB_DIR) |
||
158 | $(AR) -rcs $(LIB_DIR)/$(TARGET).a $(OBJECTS) |
||
159 | |||
160 | $(LIB_DIR): |
||
161 | mkdir $@ |
||
162 | |||
163 | $(BUILD_DIR): |
||
164 | mkdir $@ |
||
165 | |||
166 | ####################################### |
||
167 | # clean up |
||
168 | ####################################### |
||
169 | clean: |
||
170 | -rm -fR $(BUILD_DIR) |
||
171 | |||
172 | ####################################### |
||
173 | # dependencies |
||
174 | ####################################### |
||
175 | -include $(wildcard $(BUILD_DIR)/*.d) |
||
176 | |||
177 | # *** EOF *** |