bladeRF/fx3_firmware/makefile
Jon Szymaniak 8c2b16ca28 FX3 Firmware: Refactored build
These changes fix a regression caused by changeset
dc187e0640, which breaks the build
under Windows.

The firmware can now be built from the command line in both Linux and
Windows. The Eclipse project files now use the same Makefile as the
command line build, rather than generated Makefiles. As such, the
generated Debug/ has been removed.

Release builds are the default. To perform a debug build, run make
with DEBUG=y.
2013-07-06 14:14:09 -07:00

56 lines
1.2 KiB
Makefile

# 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