forked from Nuand/bladeRF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
56 lines (41 loc) · 1.21 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# bladeRF FX3 Firmware
#
# Be sure to configure you toolchain paths in make/toolchain.mk
################################################################################
ifeq ($(wildcard make/toolchain.mk),)
$(error Copy make/toolchain.mk.sample to make/toolchain.mk and edit paths accordingly before running make)
endif
include make/toolchain.mk
# Target files
TARGET := bladeRF
ELF := $(TARGET).elf
IMG := $(TARGET).img
MAP := $(TARGET).map
SRC := $(wildcard *.c)
OBJ := $(SRC:.c=.o) $(TOOLCHAIN_DEPS_OBJ)
CFLAGS := -Wall -Wextra -Wno-unused-parameter \
$(TOOLCHAIN_CFLAGS) \
$(EXTRA_CFLAGS)
ifdef DEBUG
CFLAGS += -O0 -ggdb3 -DDEBUG
else
CFLAGS += -O2 -DNDEBUG
endif
LDFLAGS := $(TOOLCHAIN_LDFLAGS) -Map $(MAP)
all: $(IMG)
$(ELF): $(OBJ)
$(LD) $(OBJ) $(LDFLAGS) -o $@
$(IMG): $(ELF) $(ELF2IMG)
$(ELF2IMG) -i $< -o $@
$(ELF2IMG): $(ELF2IMG_SRC)
$(HOST_CC) $< -O2 -o $@
# Build any toolchain dependencies.
$(TOOLCHAIN_DEPS_OBJ_C): %.o : $(TOOLCHAIN_DEPS_DIR)/%.c
$(call build_toolchain_dep,$<,$@)
$(TOOLCHAIN_DEPS_OBJ_A): %.o : $(TOOLCHAIN_DEPS_DIR)/%.S
$(call build_toolchain_dep,$<,$@)
clean:
$(RM) -f $(ELF) $(IMG) $(MAP) $(OBJ) $(TOOLCHAIN_OBJ)
realclean: clean
$(RM) -f elf2img
.PHONY: clean realclean