-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,6 @@ modules.order | |
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
|
||
# Project specific | ||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* @brief A test header | ||
*/ | ||
|
||
void testFunction(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
/** | ||
* @brief a test source file | ||
*/ | ||
|
||
#include "test.h" | ||
|
||
#include <stdio.h> | ||
|
||
#ifndef TEST_CONFIG | ||
#error "TEST_CONFIG is not defined" | ||
#endif /* TEST_DEFINE */ | ||
|
||
void testFunction(void) | ||
{ | ||
printf("\r\nHello World!"); | ||
printf("\r\nTest Config Value : %d\r\n", TEST_CONFIG); | ||
} | ||
|
||
int main(void) | ||
{ | ||
testFunction(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# | ||
# The root makefile | ||
# | ||
|
||
OUTPUT_PATH=out | ||
OUTPUT_NAME=test | ||
|
||
# The cross compile if exists, otherwise uses the gcc | ||
CROSS_COMPILE?= | ||
|
||
# | ||
# Source (.c) Files | ||
# | ||
SOURCE_FILES= \ | ||
Source/test.c | ||
|
||
# | ||
# Header (.h) File Directories | ||
# | ||
# Bear in mind, include directories must have -I prefix | ||
# | ||
INCLUDE_DIRECTORIES= \ | ||
-IInclude/ | ||
|
||
# | ||
# Project Definitions | ||
# | ||
# Bear in mind, definitions must have -D prefix | ||
# | ||
DEFINES= \ | ||
-DTEST_CONFIG=255 | ||
|
||
# | ||
# All Flags | ||
# | ||
CFLAGS=${INCLUDE_DIRECTORIES} ${DEFINES} | ||
|
||
|
||
############################################# | ||
# Rules | ||
############################################# | ||
|
||
|
||
# | ||
# The main rule | ||
# | ||
all: out test | ||
|
||
# Rebuild | ||
rebuild: clean all | ||
|
||
# The test rule | ||
test: | ||
${CROSS_COMPILE}gcc -g ${SOURCE_FILES} ${CFLAGS} -o ${OUTPUT_PATH}/${OUTPUT_NAME} | ||
|
||
# The clean rule | ||
clean: | ||
rm -f test | ||
|
||
# The rule to create out path | ||
out: | ||
mkdir -p ${OUTPUT_PATH} | ||
|
||
# The rule to run the output executable | ||
run: | ||
./${OUTPUT_PATH}/${OUTPUT_NAME} | ||
|