move apps to subdirectory, add relative path support to Makefile

This commit is contained in:
Joey Castillo 2021-09-16 15:40:01 -04:00
parent b3de08343b
commit 07420e6ead
10 changed files with 85 additions and 81 deletions

View file

@ -1,9 +0,0 @@
include ../../make.mk
INCLUDES += \
-I../
SRCS += \
../app.c
include ../../rules.mk

View file

@ -0,0 +1,10 @@
TOP = ../../..
include $(TOP)/make.mk
INCLUDES += \
-I../
SRCS += \
../app.c
include $(TOP)/rules.mk

View file

@ -1,5 +1,8 @@
# Leave this line at the top of the file; it has all the watch library sources and includes. # Leave these lines at the top of the file.
include ../../make.mk # TOP should get us to the root of the project...
TOP = ../../..
# ...and make.mk has all the watch library sources and includes.
include $(TOP)/make.mk
# If you add any other subdirectories with header files you wish to include, add them after ../ # If you add any other subdirectories with header files you wish to include, add them after ../
# Note that you will need to add a backslash at the end of any line you wish to continue, i.e. # Note that you will need to add a backslash at the end of any line you wish to continue, i.e.
@ -19,5 +22,5 @@ INCLUDES += \
SRCS += \ SRCS += \
../app.c \ ../app.c \
# Leave this line at the bottom of the file; it has all the targets for making your project. # Leave this line at the bottom of the file; rules.mk has all the targets for making your project.
include ../../rules.mk include $(TOP)/rules.mk

136
make.mk
View file

@ -12,7 +12,7 @@ endif
CC = arm-none-eabi-gcc CC = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy OBJCOPY = arm-none-eabi-objcopy
SIZE = arm-none-eabi-size SIZE = arm-none-eabi-size
UF2 = python ../../utils/uf2conv.py UF2 = python $(TOP)/utils/uf2conv.py
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
MKDIR = gmkdir MKDIR = gmkdir
@ -29,81 +29,81 @@ CFLAGS += -MD -MP -MT $(BUILD)/$(*F).o -MF $(BUILD)/$(@F).d
LDFLAGS += -mcpu=cortex-m0plus -mthumb LDFLAGS += -mcpu=cortex-m0plus -mthumb
LDFLAGS += -Wl,--gc-sections LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--script=../../watch-library/linker/saml22j18.ld LDFLAGS += -Wl,--script=$(TOP)//watch-library/linker/saml22j18.ld
# If you add any additional directories with headers, add them to this list, e.g. # If you add any additional directories with headers, add them to this list, e.g.
# ../drivers/ # ../drivers/
INCLUDES += \ INCLUDES += \
-I../../tinyusb/src \ -I$(TOP)/tinyusb/src \
-I../../boards/$(BOARD) \ -I$(TOP)/boards/$(BOARD) \
-I../../watch-library/include \ -I$(TOP)/watch-library/include \
-I../../watch-library/hal/ \ -I$(TOP)/watch-library/hal/ \
-I../../watch-library/hal/documentation/ \ -I$(TOP)/watch-library/hal/documentation/ \
-I../../watch-library/hal/include/ \ -I$(TOP)/watch-library/hal/include/ \
-I../../watch-library/hal/src/ \ -I$(TOP)/watch-library/hal/src/ \
-I../../watch-library/hal/utils/ \ -I$(TOP)/watch-library/hal/utils/ \
-I../../watch-library/hal/utils/include/ \ -I$(TOP)/watch-library/hal/utils/include/ \
-I../../watch-library/hal/utils/src/ \ -I$(TOP)/watch-library/hal/utils/src/ \
-I../../watch-library/hpl/ \ -I$(TOP)/watch-library/hpl/ \
-I../../watch-library/hpl/core/ \ -I$(TOP)/watch-library/hpl/core/ \
-I../../watch-library/hpl/dmac/ \ -I$(TOP)/watch-library/hpl/dmac/ \
-I../../watch-library/hpl/eic/ \ -I$(TOP)/watch-library/hpl/eic/ \
-I../../watch-library/hpl/gclk/ \ -I$(TOP)/watch-library/hpl/gclk/ \
-I../../watch-library/hpl/mclk/ \ -I$(TOP)/watch-library/hpl/mclk/ \
-I../../watch-library/hpl/osc32kctrl/ \ -I$(TOP)/watch-library/hpl/osc32kctrl/ \
-I../../watch-library/hpl/oscctrl/ \ -I$(TOP)/watch-library/hpl/oscctrl/ \
-I../../watch-library/hpl/pm/ \ -I$(TOP)/watch-library/hpl/pm/ \
-I../../watch-library/hpl/port/ \ -I$(TOP)/watch-library/hpl/port/ \
-I../../watch-library/hpl/rtc/ \ -I$(TOP)/watch-library/hpl/rtc/ \
-I../../watch-library/hpl/sercom/ \ -I$(TOP)/watch-library/hpl/sercom/ \
-I../../watch-library/hpl/slcd/ \ -I$(TOP)/watch-library/hpl/slcd/ \
-I../../watch-library/hpl/systick/ \ -I$(TOP)/watch-library/hpl/systick/ \
-I../../watch-library/hri/ \ -I$(TOP)/watch-library/hri/ \
-I../../watch-library/config/ \ -I$(TOP)/watch-library/config/ \
-I../../watch-library/hw/ \ -I$(TOP)/watch-library/hw/ \
-I../../watch-library/watch/ \ -I$(TOP)/watch-library/watch/ \
-I../../watch-library -I$(TOP)/watch-library
# If you add any additional C files to your project, add them each to this list, e.g. # If you add any additional C files to your project, add them each to this list, e.g.
# ../drivers/st25dv.c # ../drivers/st25dv.c
SRCS += \ SRCS += \
../../tinyusb/src/tusb.c \ $(TOP)/tinyusb/src/tusb.c \
../../tinyusb/src/common/tusb_fifo.c \ $(TOP)/tinyusb/src/common/tusb_fifo.c \
../../tinyusb/src/class/cdc/cdc_device.c \ $(TOP)/tinyusb/src/class/cdc/cdc_device.c \
../../tinyusb/src/device/usbd.c \ $(TOP)/tinyusb/src/device/usbd.c \
../../tinyusb/src/device/usbd_control.c \ $(TOP)/tinyusb/src/device/usbd_control.c \
../../tinyusb/src/portable/microchip/samd/dcd_samd.c \ $(TOP)/tinyusb/src/portable/microchip/samd/dcd_samd.c \
../../watch-library/main.c \ $(TOP)/watch-library/main.c \
../../watch-library/startup_saml22.c \ $(TOP)/watch-library/startup_saml22.c \
../../watch-library/hw/driver_init.c \ $(TOP)/watch-library/hw/driver_init.c \
../../watch-library/watch/watch.c \ $(TOP)/watch-library/watch/watch.c \
../../watch-library/hal/src/hal_atomic.c \ $(TOP)/watch-library/hal/src/hal_atomic.c \
../../watch-library/hal/src/hal_calendar.c \ $(TOP)/watch-library/hal/src/hal_calendar.c \
../../watch-library/hal/src/hal_delay.c \ $(TOP)/watch-library/hal/src/hal_delay.c \
../../watch-library/hal/src/hal_ext_irq.c \ $(TOP)/watch-library/hal/src/hal_ext_irq.c \
../../watch-library/hal/src/hal_gpio.c \ $(TOP)/watch-library/hal/src/hal_gpio.c \
../../watch-library/hal/src/hal_i2c_m_sync.c \ $(TOP)/watch-library/hal/src/hal_i2c_m_sync.c \
../../watch-library/hal/src/hal_init.c \ $(TOP)/watch-library/hal/src/hal_init.c \
../../watch-library/hal/src/hal_io.c \ $(TOP)/watch-library/hal/src/hal_io.c \
../../watch-library/hal/src/hal_slcd_sync.c \ $(TOP)/watch-library/hal/src/hal_slcd_sync.c \
../../watch-library/hal/src/hal_sleep.c \ $(TOP)/watch-library/hal/src/hal_sleep.c \
../../watch-library/hal/utils/src/utils_assert.c \ $(TOP)/watch-library/hal/utils/src/utils_assert.c \
../../watch-library/hal/utils/src/utils_event.c \ $(TOP)/watch-library/hal/utils/src/utils_event.c \
../../watch-library/hal/utils/src/utils_list.c \ $(TOP)/watch-library/hal/utils/src/utils_list.c \
../../watch-library/hal/utils/src/utils_syscalls.c \ $(TOP)/watch-library/hal/utils/src/utils_syscalls.c \
../../watch-library/hpl/core/hpl_core_m0plus_base.c \ $(TOP)/watch-library/hpl/core/hpl_core_m0plus_base.c \
../../watch-library/hpl/core/hpl_init.c \ $(TOP)/watch-library/hpl/core/hpl_init.c \
../../watch-library/hpl/dmac/hpl_dmac.c \ $(TOP)/watch-library/hpl/dmac/hpl_dmac.c \
../../watch-library/hpl/eic/hpl_eic.c \ $(TOP)/watch-library/hpl/eic/hpl_eic.c \
../../watch-library/hpl/gclk/hpl_gclk.c \ $(TOP)/watch-library/hpl/gclk/hpl_gclk.c \
../../watch-library/hpl/mclk/hpl_mclk.c \ $(TOP)/watch-library/hpl/mclk/hpl_mclk.c \
../../watch-library/hpl/osc32kctrl/hpl_osc32kctrl.c \ $(TOP)/watch-library/hpl/osc32kctrl/hpl_osc32kctrl.c \
../../watch-library/hpl/oscctrl/hpl_oscctrl.c \ $(TOP)/watch-library/hpl/oscctrl/hpl_oscctrl.c \
../../watch-library/hpl/pm/hpl_pm.c \ $(TOP)/watch-library/hpl/pm/hpl_pm.c \
../../watch-library/hpl/rtc/hpl_rtc.c \ $(TOP)/watch-library/hpl/rtc/hpl_rtc.c \
../../watch-library/hpl/sercom/hpl_sercom.c \ $(TOP)/watch-library/hpl/sercom/hpl_sercom.c \
../../watch-library/hpl/slcd/hpl_slcd.c \ $(TOP)/watch-library/hpl/slcd/hpl_slcd.c \
../../watch-library/hpl/systick/hpl_systick.c \ $(TOP)/watch-library/hpl/systick/hpl_systick.c \
DEFINES += \ DEFINES += \
-D__SAML22J18A__ \ -D__SAML22J18A__ \