PROJECTDIR = `pwd` LIBUC = /opt/libuc2 HEADERSINSTALLPATH = $(LIBUC_INC_DIR_UCSTRINGS) HEADERS += libucstrings.h SOURCES += libucstrings.c OBJDIR = obj BINDIR = bin OBJECTFILES = obj/libucstrings.o \ ARCH = stm32f4-arm-none-eabi-gcc CPUMODEL = ARCHFOLDER = $(LIBUC)/rules/stm32f4-arm-none-eabi-gcc TARGET=libucstrings LIBUC_INCLUDES=$(LIBUC_INC_DIR_STREAMDEVICES_CMD) $(LIBUC_INC_DIR_UHANDLE_CMD) LIBUC_LIBRARIES=$(LIBUC_LIBS_DIR_STREAMDEVICES_CMD) $(LIBUC_LIBS_STREAMDEVICES) $(LIBUC_LIBS_DIR_UHANDLE_CMD) $(LIBUC_LIBS_UHANDLE) TARGETINSTALLPATH=$(LIBUC_LIBS_DIR_UCSTRINGS) HEADERSINSTALLPATH=$(LIBUC_INC_DIR_UCSTRINGS) BSP=generic #--------------------------------------------------------------------------------- # LIBRARY DEFINITIONS #--------------------------------------------------------------------------------- LIBUC_LIBS_DIR = $(LIBUC)/lib/bin/$(ARCH) LIBUC_INC_DIR = $(LIBUC)/lib/includes LIBUC_CFG_DIR = $(LIBUC)/lib/cfg include $(LIBUC)/rules/common/libsrules.mk #--------------------------------------------------------------------------------- # BOARD SUPORT PACKAGES #--------------------------------------------------------------------------------- LIBUC_BSP_DIR=$(LIBUC)/bsp LIBUC_BSP_BIN_DIR= $(LIBUC_BSP_DIR)/bin LIBUC_BSP_INC_DIR= $(LIBUC_BSP_DIR)/includes LIBUC_BSP_CFG_DIR= $(LIBUC_BSP_DIR)/cfg LIBUC_BSP = -L $(LIBUC_BSP_BIN_DIR)/$(BSP) -static -lbsp LIBUC_BSP_INC = -I $(LIBUC_BSP_INC_DIR)/$(BSP) include $(ARCHFOLDER)/rules.mk INCLUDES += -I ./ -I $(LIBUC_INC_DIR) $(LIBUC_INCLUDES) $(LIBUC_BSP_INC) 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) $(APPOBJECTFILES) $(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 obj/libucstrings.o: libucstrings.c $(OBJDIR) $(LIBUC_CC) -O3 -I $(INCLUDES) -c $(CFLAGS) $< -o $@ install:libinstall libclean: rm -f $(TARGETINSTALLPATH)/$(TARGET).a