From 07420e6ead840973d7136222b8e872261a7b18b8 Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Thu, 16 Sep 2021 15:40:01 -0400 Subject: [PATCH] move apps to subdirectory, add relative path support to Makefile --- Sensor Watch BME280 Project/make/Makefile | 9 -- .../Sensor Watch BME280 Project}/app.c | 0 .../Sensor Watch BME280 Project}/app.h | 0 .../Sensor Watch BME280 Project}/bme280.h | 0 .../make/.gitignore | 0 .../Sensor Watch BME280 Project/make/Makefile | 10 ++ .../Sensor Watch Starter Project}/app.c | 0 .../make/.gitignore | 0 .../make/Makefile | 11 +- make.mk | 136 +++++++++--------- 10 files changed, 85 insertions(+), 81 deletions(-) delete mode 100755 Sensor Watch BME280 Project/make/Makefile rename {Sensor Watch BME280 Project => apps/Sensor Watch BME280 Project}/app.c (100%) rename {Sensor Watch BME280 Project => apps/Sensor Watch BME280 Project}/app.h (100%) rename {Sensor Watch BME280 Project => apps/Sensor Watch BME280 Project}/bme280.h (100%) rename {Sensor Watch BME280 Project => apps/Sensor Watch BME280 Project}/make/.gitignore (100%) create mode 100755 apps/Sensor Watch BME280 Project/make/Makefile rename {Sensor Watch Starter Project => apps/Sensor Watch Starter Project}/app.c (100%) rename {Sensor Watch Starter Project => apps/Sensor Watch Starter Project}/make/.gitignore (100%) rename {Sensor Watch Starter Project => apps/Sensor Watch Starter Project}/make/Makefile (63%) diff --git a/Sensor Watch BME280 Project/make/Makefile b/Sensor Watch BME280 Project/make/Makefile deleted file mode 100755 index 358bb86..0000000 --- a/Sensor Watch BME280 Project/make/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -include ../../make.mk - -INCLUDES += \ - -I../ - -SRCS += \ - ../app.c - -include ../../rules.mk diff --git a/Sensor Watch BME280 Project/app.c b/apps/Sensor Watch BME280 Project/app.c similarity index 100% rename from Sensor Watch BME280 Project/app.c rename to apps/Sensor Watch BME280 Project/app.c diff --git a/Sensor Watch BME280 Project/app.h b/apps/Sensor Watch BME280 Project/app.h similarity index 100% rename from Sensor Watch BME280 Project/app.h rename to apps/Sensor Watch BME280 Project/app.h diff --git a/Sensor Watch BME280 Project/bme280.h b/apps/Sensor Watch BME280 Project/bme280.h similarity index 100% rename from Sensor Watch BME280 Project/bme280.h rename to apps/Sensor Watch BME280 Project/bme280.h diff --git a/Sensor Watch BME280 Project/make/.gitignore b/apps/Sensor Watch BME280 Project/make/.gitignore similarity index 100% rename from Sensor Watch BME280 Project/make/.gitignore rename to apps/Sensor Watch BME280 Project/make/.gitignore diff --git a/apps/Sensor Watch BME280 Project/make/Makefile b/apps/Sensor Watch BME280 Project/make/Makefile new file mode 100755 index 0000000..c66ad20 --- /dev/null +++ b/apps/Sensor Watch BME280 Project/make/Makefile @@ -0,0 +1,10 @@ +TOP = ../../.. +include $(TOP)/make.mk + +INCLUDES += \ + -I../ + +SRCS += \ + ../app.c + +include $(TOP)/rules.mk diff --git a/Sensor Watch Starter Project/app.c b/apps/Sensor Watch Starter Project/app.c similarity index 100% rename from Sensor Watch Starter Project/app.c rename to apps/Sensor Watch Starter Project/app.c diff --git a/Sensor Watch Starter Project/make/.gitignore b/apps/Sensor Watch Starter Project/make/.gitignore similarity index 100% rename from Sensor Watch Starter Project/make/.gitignore rename to apps/Sensor Watch Starter Project/make/.gitignore diff --git a/Sensor Watch Starter Project/make/Makefile b/apps/Sensor Watch Starter Project/make/Makefile similarity index 63% rename from Sensor Watch Starter Project/make/Makefile rename to apps/Sensor Watch Starter Project/make/Makefile index bf6d423..09a59a0 100755 --- a/Sensor Watch Starter Project/make/Makefile +++ b/apps/Sensor Watch Starter Project/make/Makefile @@ -1,5 +1,8 @@ -# Leave this line at the top of the file; it has all the watch library sources and includes. -include ../../make.mk +# Leave these lines at the top of the file. +# 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 ../ # 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 += \ ../app.c \ -# Leave this line at the bottom of the file; it has all the targets for making your project. -include ../../rules.mk +# Leave this line at the bottom of the file; rules.mk has all the targets for making your project. +include $(TOP)/rules.mk diff --git a/make.mk b/make.mk index b892be9..461bef7 100644 --- a/make.mk +++ b/make.mk @@ -12,7 +12,7 @@ endif CC = arm-none-eabi-gcc OBJCOPY = arm-none-eabi-objcopy SIZE = arm-none-eabi-size -UF2 = python ../../utils/uf2conv.py +UF2 = python $(TOP)/utils/uf2conv.py ifeq ($(OS), Windows_NT) MKDIR = gmkdir @@ -29,81 +29,81 @@ CFLAGS += -MD -MP -MT $(BUILD)/$(*F).o -MF $(BUILD)/$(@F).d LDFLAGS += -mcpu=cortex-m0plus -mthumb 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. # ../drivers/ INCLUDES += \ - -I../../tinyusb/src \ - -I../../boards/$(BOARD) \ - -I../../watch-library/include \ - -I../../watch-library/hal/ \ - -I../../watch-library/hal/documentation/ \ - -I../../watch-library/hal/include/ \ - -I../../watch-library/hal/src/ \ - -I../../watch-library/hal/utils/ \ - -I../../watch-library/hal/utils/include/ \ - -I../../watch-library/hal/utils/src/ \ - -I../../watch-library/hpl/ \ - -I../../watch-library/hpl/core/ \ - -I../../watch-library/hpl/dmac/ \ - -I../../watch-library/hpl/eic/ \ - -I../../watch-library/hpl/gclk/ \ - -I../../watch-library/hpl/mclk/ \ - -I../../watch-library/hpl/osc32kctrl/ \ - -I../../watch-library/hpl/oscctrl/ \ - -I../../watch-library/hpl/pm/ \ - -I../../watch-library/hpl/port/ \ - -I../../watch-library/hpl/rtc/ \ - -I../../watch-library/hpl/sercom/ \ - -I../../watch-library/hpl/slcd/ \ - -I../../watch-library/hpl/systick/ \ - -I../../watch-library/hri/ \ - -I../../watch-library/config/ \ - -I../../watch-library/hw/ \ - -I../../watch-library/watch/ \ - -I../../watch-library + -I$(TOP)/tinyusb/src \ + -I$(TOP)/boards/$(BOARD) \ + -I$(TOP)/watch-library/include \ + -I$(TOP)/watch-library/hal/ \ + -I$(TOP)/watch-library/hal/documentation/ \ + -I$(TOP)/watch-library/hal/include/ \ + -I$(TOP)/watch-library/hal/src/ \ + -I$(TOP)/watch-library/hal/utils/ \ + -I$(TOP)/watch-library/hal/utils/include/ \ + -I$(TOP)/watch-library/hal/utils/src/ \ + -I$(TOP)/watch-library/hpl/ \ + -I$(TOP)/watch-library/hpl/core/ \ + -I$(TOP)/watch-library/hpl/dmac/ \ + -I$(TOP)/watch-library/hpl/eic/ \ + -I$(TOP)/watch-library/hpl/gclk/ \ + -I$(TOP)/watch-library/hpl/mclk/ \ + -I$(TOP)/watch-library/hpl/osc32kctrl/ \ + -I$(TOP)/watch-library/hpl/oscctrl/ \ + -I$(TOP)/watch-library/hpl/pm/ \ + -I$(TOP)/watch-library/hpl/port/ \ + -I$(TOP)/watch-library/hpl/rtc/ \ + -I$(TOP)/watch-library/hpl/sercom/ \ + -I$(TOP)/watch-library/hpl/slcd/ \ + -I$(TOP)/watch-library/hpl/systick/ \ + -I$(TOP)/watch-library/hri/ \ + -I$(TOP)/watch-library/config/ \ + -I$(TOP)/watch-library/hw/ \ + -I$(TOP)/watch-library/watch/ \ + -I$(TOP)/watch-library # If you add any additional C files to your project, add them each to this list, e.g. # ../drivers/st25dv.c SRCS += \ - ../../tinyusb/src/tusb.c \ - ../../tinyusb/src/common/tusb_fifo.c \ - ../../tinyusb/src/class/cdc/cdc_device.c \ - ../../tinyusb/src/device/usbd.c \ - ../../tinyusb/src/device/usbd_control.c \ - ../../tinyusb/src/portable/microchip/samd/dcd_samd.c \ - ../../watch-library/main.c \ - ../../watch-library/startup_saml22.c \ - ../../watch-library/hw/driver_init.c \ - ../../watch-library/watch/watch.c \ - ../../watch-library/hal/src/hal_atomic.c \ - ../../watch-library/hal/src/hal_calendar.c \ - ../../watch-library/hal/src/hal_delay.c \ - ../../watch-library/hal/src/hal_ext_irq.c \ - ../../watch-library/hal/src/hal_gpio.c \ - ../../watch-library/hal/src/hal_i2c_m_sync.c \ - ../../watch-library/hal/src/hal_init.c \ - ../../watch-library/hal/src/hal_io.c \ - ../../watch-library/hal/src/hal_slcd_sync.c \ - ../../watch-library/hal/src/hal_sleep.c \ - ../../watch-library/hal/utils/src/utils_assert.c \ - ../../watch-library/hal/utils/src/utils_event.c \ - ../../watch-library/hal/utils/src/utils_list.c \ - ../../watch-library/hal/utils/src/utils_syscalls.c \ - ../../watch-library/hpl/core/hpl_core_m0plus_base.c \ - ../../watch-library/hpl/core/hpl_init.c \ - ../../watch-library/hpl/dmac/hpl_dmac.c \ - ../../watch-library/hpl/eic/hpl_eic.c \ - ../../watch-library/hpl/gclk/hpl_gclk.c \ - ../../watch-library/hpl/mclk/hpl_mclk.c \ - ../../watch-library/hpl/osc32kctrl/hpl_osc32kctrl.c \ - ../../watch-library/hpl/oscctrl/hpl_oscctrl.c \ - ../../watch-library/hpl/pm/hpl_pm.c \ - ../../watch-library/hpl/rtc/hpl_rtc.c \ - ../../watch-library/hpl/sercom/hpl_sercom.c \ - ../../watch-library/hpl/slcd/hpl_slcd.c \ - ../../watch-library/hpl/systick/hpl_systick.c \ + $(TOP)/tinyusb/src/tusb.c \ + $(TOP)/tinyusb/src/common/tusb_fifo.c \ + $(TOP)/tinyusb/src/class/cdc/cdc_device.c \ + $(TOP)/tinyusb/src/device/usbd.c \ + $(TOP)/tinyusb/src/device/usbd_control.c \ + $(TOP)/tinyusb/src/portable/microchip/samd/dcd_samd.c \ + $(TOP)/watch-library/main.c \ + $(TOP)/watch-library/startup_saml22.c \ + $(TOP)/watch-library/hw/driver_init.c \ + $(TOP)/watch-library/watch/watch.c \ + $(TOP)/watch-library/hal/src/hal_atomic.c \ + $(TOP)/watch-library/hal/src/hal_calendar.c \ + $(TOP)/watch-library/hal/src/hal_delay.c \ + $(TOP)/watch-library/hal/src/hal_ext_irq.c \ + $(TOP)/watch-library/hal/src/hal_gpio.c \ + $(TOP)/watch-library/hal/src/hal_i2c_m_sync.c \ + $(TOP)/watch-library/hal/src/hal_init.c \ + $(TOP)/watch-library/hal/src/hal_io.c \ + $(TOP)/watch-library/hal/src/hal_slcd_sync.c \ + $(TOP)/watch-library/hal/src/hal_sleep.c \ + $(TOP)/watch-library/hal/utils/src/utils_assert.c \ + $(TOP)/watch-library/hal/utils/src/utils_event.c \ + $(TOP)/watch-library/hal/utils/src/utils_list.c \ + $(TOP)/watch-library/hal/utils/src/utils_syscalls.c \ + $(TOP)/watch-library/hpl/core/hpl_core_m0plus_base.c \ + $(TOP)/watch-library/hpl/core/hpl_init.c \ + $(TOP)/watch-library/hpl/dmac/hpl_dmac.c \ + $(TOP)/watch-library/hpl/eic/hpl_eic.c \ + $(TOP)/watch-library/hpl/gclk/hpl_gclk.c \ + $(TOP)/watch-library/hpl/mclk/hpl_mclk.c \ + $(TOP)/watch-library/hpl/osc32kctrl/hpl_osc32kctrl.c \ + $(TOP)/watch-library/hpl/oscctrl/hpl_oscctrl.c \ + $(TOP)/watch-library/hpl/pm/hpl_pm.c \ + $(TOP)/watch-library/hpl/rtc/hpl_rtc.c \ + $(TOP)/watch-library/hpl/sercom/hpl_sercom.c \ + $(TOP)/watch-library/hpl/slcd/hpl_slcd.c \ + $(TOP)/watch-library/hpl/systick/hpl_systick.c \ DEFINES += \ -D__SAML22J18A__ \