|
|
PROJECTDIR = `pwd`
|
|
|
LIBUC = /opt/libuc2
|
|
|
|
|
|
HEADERSINSTALLPATH =
|
|
|
HEADERS +=
|
|
|
SOURCES += gpio.c
|
|
|
OBJDIR = obj
|
|
|
BINDIR = bin
|
|
|
OBJECTFILES = obj/gpio.o \
|
|
|
|
|
|
ARCH = stm32f4-arm-none-eabi-gcc
|
|
|
ARCHFOLDER = $(LIBUC)/rules/stm32f4-arm-none-eabi-gcc
|
|
|
TARGET=libgpio
|
|
|
LIBUC_INCLUDES=$(LIBUC_INC_DIR_CORE_CMD) $(LIBUC_INC_DIR_UHANDLE_CMD) $(LIBUC_INC_DIR_CPU_CMD) -I $(LIBUC_INC_DIR_GPIO)
|
|
|
LIBUC_LIBRARIES=$(LIBUC_LIBS_DIR_CORE_CMD) $(LIBUC_LIBS_CORE) $(LIBUC_LIBS_DIR_UHANDLE_CMD) $(LIBUC_LIBS_UHANDLE) $(LIBUC_LIBS_DIR_CPU_CMD) $(LIBUC_LIBS_CPU)
|
|
|
TARGETINSTALLPATH=$(LIBUC_LIBS_DIR_GPIO)
|
|
|
HEADERSINSTALLPATH=
|
|
|
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) $(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/gpio.o: gpio.c $(OBJDIR)
|
|
|
$(LIBUC_CC) -O3 -I $(INCLUDES) -c $(CFLAGS) $< -o $@
|
|
|
|
|
|
install:libinstall
|
|
|
|
|
|
|
|
|
libclean:
|
|
|
rm -f $(TARGETINSTALLPATH)/$(TARGET).a
|
|
|
|