Skip to content

Commit

Permalink
Added Template Module
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoHood authored and abcminiuser committed Oct 1, 2017
1 parent 53bccb3 commit 8a06517
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 1 deletion.
49 changes: 49 additions & 0 deletions Template/lib/TEMPLATE_LIB/TEMPLATE_LIB.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# DMBS Build System
# Released into the public domain.
#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#

# Include Guard
ifeq ($(findstring TEMPLATE_LIB, $(DMBS_BUILD_MODULES)),)

# Sanity check user supplied DMBS path
ifndef DMBS_PATH
$(error Makefile DMBS_PATH option cannot be blank)
endif

# Location of the current module
TEMPLATE_LIB_MODULE_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))

# Import the CORE module of DMBS
include $(DMBS_PATH)/core.mk

# This module needs to be included before gcc.mk
ifneq ($(findstring GCC, $(DMBS_BUILD_MODULES)),)
$(error Include this module before gcc.mk)
endif

# Help settings
DMBS_BUILD_MODULES += TEMPLATE_LIB
DMBS_BUILD_TARGETS +=
DMBS_BUILD_MANDATORY_VARS += DMBS_PATH
DMBS_BUILD_OPTIONAL_VARS +=
DMBS_BUILD_PROVIDED_VARS += TEMPLATE_LIB_SRC
DMBS_BUILD_PROVIDED_MACROS +=

# Sanity check user supplied values
$(foreach MANDATORY_VAR, $(DMBS_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR)))

# TEMPLATE_LIB Library
TEMPLATE_LIB_SRC := $(TEMPLATE_LIB_MODULE_PATH)/src/template_lib.c

# Compiler flags and sources
SRC += $(TEMPLATE_LIB_SRC)
CC_FLAGS += -I$(TEMPLATE_LIB_MODULE_PATH)/include/

# Phony build targets for this module
.PHONY: $(DMBS_BUILD_TARGETS)

endif
24 changes: 24 additions & 0 deletions Template/lib/TEMPLATE_LIB/include/template_lib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
DMBS Build System
Released into the public domain.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/

// Include Guard
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

// Software version
#define TEMPLATE_LIB_VERSION 100

#include <stdint.h>
#include <stddef.h>

#ifdef __cplusplus
}
#endif
10 changes: 10 additions & 0 deletions Template/lib/TEMPLATE_LIB/src/template_lib.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
DMBS Build System
Released into the public domain.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/

#include "template_lib.h"
#include "template_lib_private.h"
14 changes: 14 additions & 0 deletions Template/lib/TEMPLATE_LIB/src/template_lib_private.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
DMBS Build System
Released into the public domain.
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/

// Include Guard
#pragma once

#include <stdint.h>
#include <stddef.h>
#include <avr/io.h>
6 changes: 5 additions & 1 deletion Template/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ LD_FLAGS =
# Default target
all:

# Include DMBS build script makefiles
# Include libraries and DMBS build script makefiles
DMBS_PATH ?= ../DMBS
LIB_PATH ?= lib

include $(LIB_PATH)/TEMPLATE_LIB/TEMPLATE_LIB.mk

include $(DMBS_PATH)/core.mk
include $(DMBS_PATH)/gcc.mk
include $(DMBS_PATH)/cppcheck.mk
Expand Down

0 comments on commit 8a06517

Please sign in to comment.