lpc17XX.mk
95 lines
| 2.4 KiB
| text/x-makefile
|
MakefileLexer
|
r18 | PROJECTDIR = `pwd` | ||
LIBUC = /opt/libuc2 | ||||
HEADERSINSTALLPATH = $(LIBUC_INC_DIR_24LC0X) | ||||
HEADERS += 24LC0X.h | ||||
SOURCES += 24LC0X.c | ||||
OBJDIR = obj | ||||
BINDIR = bin | ||||
OBJECTFILES = | ||||
ARCH = stm32f4-arm-none-eabi-gcc | ||||
ARCHFOLDER = $(LIBUC)/rules/stm32f4-arm-none-eabi-gcc | ||||
TARGET=lib24lc0X | ||||
LIBUC_INCLUDES=$(LIBUC_INC_DIR_CORE_CMD) $(LIBUC_INC_DIR_IIC_CMD) $(LIBUC_INC_DIR_UHANDLE_CMD) | ||||
LIBUC_LIBRARIES=$(LIBUC_LIBS_DIR_CORE_CMD) $(LIBUC_LIBS_CORE) $(LIBUC_LIBS_DIR_IIC_CMD) $(LIBUC_LIBS_IIC) $(LIBUC_LIBS_DIR_UHANDLE_CMD) $(LIBUC_LIBS_UHANDLE) | ||||
TARGETINSTALLPATH=$(LIBUC_LIBS_DIR_24LC0X) | ||||
HEADERSINSTALLPATH=$(LIBUC_INC_DIR_24LC0X) | ||||
BSP=generic | ||||
include $(ARCHFOLDER)/rules.mk | ||||
INCLUDES += -I ./ | ||||
all:lib | ||||
@echo Code compiled | ||||
.SUFFIXES: .o .c .s | ||||
.c.o: | ||||
$(LIBUC_CC) -O3 -I $(INCLUDES) -c $(CFLAGS) $< -o $@ | ||||
.s.o: | ||||
$(LIBUC_CC) -O3 -I $(INCLUDES) -c $(CFLAGS) $< -o $@ | ||||
bin: $(BINDIR)/$(TARGET).elf $(BINDIR)/$(TARGET).bin $(BINDIR)/$(TARGET).hex | ||||
@echo "compile bin" | ||||
lib: $(BINDIR)/$(TARGET).a | ||||
@echo "compile lib" | ||||
$(BINDIR)/$(TARGET).a: $(OBJECTFILES) | ||||
mkdir -p $(BINDIR) | ||||
$(LIBUC_AR) rcs $@ $(OBJECTFILES) | ||||
$(OBJDIR): | ||||
mkdir -p $(OBJDIR) | ||||
%.elf: $(LINKER_SCRIPT) $(OBJECTFILES) | ||||
mkdir -p $(BINDIR) | ||||
$(LIBUC_CC) $(LIBUC_LDFLAGS) $(LIBUC_CFLAGS) -T $^ -o $@ $(LIBUC_BSP) $(LIBUC_LIBRARIES) | ||||
$(LIBUC_OBJDUMP) $(LIBUC_ODFLAGS) $@ > $(@:.elf=.dump) | ||||
$(LIBUC_SIZE) $@ | ||||
%.bin: %.elf $(BIN_LIBS_DEPS) | ||||
$(LIBUC_OBJCOPY) $(LIBUC_CPFLAGS) -O binary $< $*.bin | ||||
@echo "BIN_LIBS_DEPS" | ||||
@echo $(BIN_LIBS_DEPS) | ||||
%.hex: %.elf | ||||
$(LIBUC_OBJCOPY) $(LIBUC_CPFLAGS) -O ihex $< $*.hex | ||||
$(TARGETINSTALLPATH)/$(TARGET).a: $(BINDIR)/$(TARGET).a | ||||
mkdir -p $(TARGETINSTALLPATH) | ||||
cp $(BINDIR)/$(TARGET).a $(TARGETINSTALLPATH)/$(TARGET).a | ||||
libinstall: $(TARGETINSTALLPATH)/$(TARGET).a | ||||
@if [ -z $(HEADERSINSTALLPATH) ] ; then echo "No headers to install" ; else mkdir -p $(HEADERSINSTALLPATH) ; fi | ||||
@if [ -z "$(HEADERS)" ] ; then echo "No headers to install" ; else echo "cp -f $(HEADERS) $(HEADERSINSTALLPATH)/" ; cp -f $(HEADERS) $(HEADERSINSTALLPATH)/ ; fi | ||||
clean: | ||||
rm -f *.o *.d *.bin *.hex *.dump *.map *.a *.elf | ||||
rm -f $(OBJECTFILES) | ||||
rm -f $(BINDIR)/*.bin | ||||
rm -f $(BINDIR)/*.hex | ||||
rm -f $(BINDIR)/*.dump | ||||
rm -f $(BINDIR)/*.map | ||||
rm -f $(BINDIR)/*.a | ||||
rm -f $(BINDIR)/*.elf | ||||
rm -f $(DEVSOURCESND) | ||||
rm -f $(ASMDEVSOURCESND) | ||||
distclean: clean libclean | ||||
rm -f $(TARGETINSTALLPATH)/*.bin | ||||
rm -f $(TARGETINSTALLPATH)/*.a | ||||
rm -f Makefile | ||||
install:libinstall | ||||
libclean: | ||||
rm -f $(TARGETINSTALLPATH)/$(TARGET).a | ||||