Skip to content

Commit

Permalink
Make builds invoked through projects automatically happen in the proj…
Browse files Browse the repository at this point in the history
…ect directory
  • Loading branch information
KrisSlyka committed May 10, 2023
1 parent ddbb24d commit c889cb8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
build/
libwdsp*.a
build/
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"recommendations": [
"marus25.cortex-debug",
"ms-vscode.cpptools"
]
}
9 changes: 5 additions & 4 deletions buildvars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
export OPT ?= -O3
export DEBUG ?= false
export BOARD ?= wdsp-dev
export BUILD_ROOT ?= build

ifeq ($(DEBUG), true)
export LIB_NAME ?= libwdsp-debug
export BUILD_DIR ?= $(BUILD_ROOT)/debug/$(BOARD)
else
export LIB_NAME ?= libwdsp
export BUILD_DIR ?= $(BUILD_ROOT)/release/$(BOARD)
endif

ifeq ($(DEBUG), true)
export BUILD_DIR ?= build/debug/$(BOARD)
export LIB_NAME ?= $(BUILD_ROOT)/libwdsp-$(BOARD)-debug
else
export BUILD_DIR ?= build/release/$(BOARD)
export LIB_NAME ?= $(BUILD_ROOT)/libwdsp-$(BOARD)
endif

export CONFIG_DIR = $(BUILD_DIR)/config
Expand Down
7 changes: 4 additions & 3 deletions libwdsp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ endif
WDSP_PATH := $(dir $(lastword $(MAKEFILE_LIST)))
CONFIG_FILE ?= $(wildcard ./config.ini)

export USER_CONFIG ?= $(realpath $(CONFIG_FILE))
export USER_CONFIG ?= $(abspath $(CONFIG_FILE))
export BUILD_ROOT ?= $(abspath .wdsp)

include $(WDSP_PATH)/buildvars.mk
include $(WDSP_PATH)/init.mk

C_INCLUDES = \
-I $(WDSP_PATH)/$(CONFIG_DIR) \
-I $(CONFIG_DIR) \
-I $(WDSP_PATH)/includes/libwdsp \
-I $(WDSP_PATH)/boards/$(BOARD) \
-I $(WDSP_PATH)/cores/$(CORE)
Expand Down Expand Up @@ -46,7 +47,7 @@ $(TARGET).hex: $(TARGET)
$(TARGET).bin: $(TARGET)
$(BIN) $< $@

$(TARGET): $(WDSP_PATH)/$(LIB_NAME).a
$(TARGET): $(LIB_NAME).a

.PHONY: libclean
libclean:
Expand Down
4 changes: 4 additions & 0 deletions template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Example .gitignore only ignores libWDSP out of tree build directory.
# Add your own ignores to suit your taste.

.wdsp/

0 comments on commit c889cb8

Please sign in to comment.