-
Notifications
You must be signed in to change notification settings - Fork 19
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
5 changed files
with
613 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 |
---|---|---|
|
@@ -19,3 +19,6 @@ | |
*.out | ||
*.hex | ||
*.eep | ||
|
||
# Unignore Makefile | ||
!Makefile |
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,151 @@ | ||
#---------------------------------------------------------------------------- | ||
# BEWARE: Messed up by makefile NOOB Michael Clift for Command line applications | ||
# | ||
|
||
# Target file name (without extension). | ||
TARGET = heap-buf | ||
|
||
# List C source files here. (C dependencies are automatically generated.) | ||
# To exclude certain files in a folder remove the $(wildcard) and | ||
# list them seperated by spaces, ie src/main.c src/util.c | ||
SRC = heap-buf.c ../../strbuf.c ../../strview.c | ||
|
||
# List any extra directories to look for include files here. | ||
# Each directory must be seperated by a space. | ||
# Use forward slashes for directory separators. | ||
# For a directory that has spaces, enclose it in quotes. | ||
EXTRAINCDIRS = . ../.. | ||
|
||
# Object and list files directory | ||
# To put .o and .lst files alongside .c files use a dot (.), do NOT make | ||
# this an empty or blank macro! | ||
# If source files are in sub directories, matching subdirectories must exist under this folder for the .o files | ||
# This is a pain, if you can fix this, please do and share. | ||
OBJLSTDIR = . | ||
|
||
# Compiler flag to set the C Standard level. | ||
# c89 = "ANSI" C | ||
# gnu89 = c89 plus GCC extensions | ||
# c99 = ISO C99 standard (not yet fully implemented) | ||
# gnu99 = c99 plus GCC extensions | ||
CSTANDARD = -std=gnu99 | ||
|
||
# Place -D or -U options here for C sources | ||
CDEFS = -DPLATFORM_PC | ||
|
||
#---------------- Compiler Options C ---------------- | ||
# -g debug information | ||
# -f...: tuning, see GCC manual and avr-libc documentation | ||
# -Wall...: warning level | ||
CFLAGS += $(CDEFS) | ||
CFLAGS += -Wall | ||
CFLAGS += -Wno-unused-function | ||
CFLAGS += -Wno-unused-but-set-variable | ||
CFLAGS += $(CSTANDARD) | ||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) | ||
|
||
# List any extra directories to look for libraries here. | ||
# Each directory must be seperated by a space. | ||
# Use forward slashes for directory separators. | ||
# For a directory that has spaces, enclose it in quotes. | ||
EXTRALIBDIRS = . | ||
EXTRALIBS = -lm | ||
|
||
#---------------- Linker Options ---------------- | ||
|
||
LDFLAGS = $(patsubst %,-L%,$(EXTRALIBDIRS)) | ||
LDFLAGS += $(EXTRALIBS) | ||
|
||
#============================================================================ | ||
|
||
# Define programs and commands. | ||
SHELL = sh | ||
CC = gcc | ||
REMOVE = rm -f | ||
REMOVEDIR = rm -rf | ||
COPY = cp | ||
|
||
# Define Messages | ||
# English | ||
MSG_ERRORS_NONE = Errors: none | ||
MSG_BEGIN = -------- begin -------- | ||
MSG_END = -------- end -------- | ||
MSG_LINKING = Linking: | ||
MSG_COMPILING = Compiling C: | ||
MSG_CLEANING = Cleaning project: | ||
|
||
# Define all object files. | ||
OBJ = $(SRC:%.c=$(OBJLSTDIR)/%.o) | ||
|
||
# Compiler flags to generate dependency files. | ||
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d | ||
|
||
# Combine all necessary flags and optional flags. | ||
# Add target processor to flags. | ||
ALL_CFLAGS = -I. $(CFLAGS) $(GENDEPFLAGS) | ||
|
||
# Default target. | ||
all: begin gccversion buildinfo build end | ||
|
||
|
||
build: tgt | ||
|
||
tgt: $(TARGET) | ||
|
||
# Eye candy. | ||
# the following magic strings to be generated by the compile job. | ||
begin: | ||
@echo | ||
@echo $(MSG_BEGIN) | ||
|
||
end: | ||
@cat build_date.inc | ||
@echo $(MSG_END) | ||
@echo | ||
|
||
# Gather information about build | ||
buildinfo: | ||
@$(CC) --version | grep gcc | awk '{print "\x22" $$0 "\x22"}' > gcc_version.inc | ||
@date --iso-8601=seconds -u | awk '{print "\x22" $$0 "\x22"}' > build_date.inc | ||
@read LASTNUM < build_number.inc; \ | ||
NEWNUM=$$(($$LASTNUM + 1)); \ | ||
echo "$$NEWNUM" > build_number.inc | ||
@touch version.c | ||
|
||
# Display compiler version information. | ||
gccversion : | ||
@$(CC) --version | ||
|
||
|
||
# Link: create output file from object files. | ||
.SECONDARY : $(TARGET) | ||
.PRECIOUS : $(OBJ) | ||
$(TARGET): $(OBJ) | ||
@echo | ||
@echo $(MSG_LINKING) $@ | ||
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) | ||
|
||
# Compile: create object files from C source files. | ||
$(OBJLSTDIR)/%.o : %.c | ||
@echo | ||
@echo $(MSG_COMPILING) $< | ||
$(CC) -c $(ALL_CFLAGS) $< -o $@ | ||
|
||
# Target: clean project. | ||
clean: begin clean_list end | ||
|
||
clean_list : | ||
@echo | ||
@echo $(MSG_CLEANING) | ||
$(REMOVE) $(SRC:%.c=$(OBJLSTDIR)/%.o) | ||
$(REMOVE) $(SRC:%.c=$(OBJLSTDIR)/%.lst) | ||
$(REMOVEDIR) .dep | ||
|
||
# Create object files directory | ||
$(shell mkdir $(OBJLSTDIR) 2>/dev/null) | ||
|
||
# Include the dependency files. | ||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) | ||
|
||
# Listing of phony targets. | ||
.PHONY : all begin end buildinfo gccversion build tgt clean clean_list |
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,151 @@ | ||
#---------------------------------------------------------------------------- | ||
# BEWARE: Messed up by makefile NOOB Michael Clift for Command line applications | ||
# | ||
|
||
# Target file name (without extension). | ||
TARGET = stack-buf | ||
|
||
# List C source files here. (C dependencies are automatically generated.) | ||
# To exclude certain files in a folder remove the $(wildcard) and | ||
# list them seperated by spaces, ie src/main.c src/util.c | ||
SRC = stack-buf.c ../../strbuf.c ../../strview.c | ||
|
||
# List any extra directories to look for include files here. | ||
# Each directory must be seperated by a space. | ||
# Use forward slashes for directory separators. | ||
# For a directory that has spaces, enclose it in quotes. | ||
EXTRAINCDIRS = . ../.. | ||
|
||
# Object and list files directory | ||
# To put .o and .lst files alongside .c files use a dot (.), do NOT make | ||
# this an empty or blank macro! | ||
# If source files are in sub directories, matching subdirectories must exist under this folder for the .o files | ||
# This is a pain, if you can fix this, please do and share. | ||
OBJLSTDIR = . | ||
|
||
# Compiler flag to set the C Standard level. | ||
# c89 = "ANSI" C | ||
# gnu89 = c89 plus GCC extensions | ||
# c99 = ISO C99 standard (not yet fully implemented) | ||
# gnu99 = c99 plus GCC extensions | ||
CSTANDARD = -std=gnu99 | ||
|
||
# Place -D or -U options here for C sources | ||
CDEFS = -DPLATFORM_PC | ||
|
||
#---------------- Compiler Options C ---------------- | ||
# -g debug information | ||
# -f...: tuning, see GCC manual and avr-libc documentation | ||
# -Wall...: warning level | ||
CFLAGS += $(CDEFS) | ||
CFLAGS += -Wall | ||
CFLAGS += -Wno-unused-function | ||
CFLAGS += -Wno-unused-but-set-variable | ||
CFLAGS += $(CSTANDARD) | ||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) | ||
|
||
# List any extra directories to look for libraries here. | ||
# Each directory must be seperated by a space. | ||
# Use forward slashes for directory separators. | ||
# For a directory that has spaces, enclose it in quotes. | ||
EXTRALIBDIRS = . | ||
EXTRALIBS = -lm | ||
|
||
#---------------- Linker Options ---------------- | ||
|
||
LDFLAGS = $(patsubst %,-L%,$(EXTRALIBDIRS)) | ||
LDFLAGS += $(EXTRALIBS) | ||
|
||
#============================================================================ | ||
|
||
# Define programs and commands. | ||
SHELL = sh | ||
CC = gcc | ||
REMOVE = rm -f | ||
REMOVEDIR = rm -rf | ||
COPY = cp | ||
|
||
# Define Messages | ||
# English | ||
MSG_ERRORS_NONE = Errors: none | ||
MSG_BEGIN = -------- begin -------- | ||
MSG_END = -------- end -------- | ||
MSG_LINKING = Linking: | ||
MSG_COMPILING = Compiling C: | ||
MSG_CLEANING = Cleaning project: | ||
|
||
# Define all object files. | ||
OBJ = $(SRC:%.c=$(OBJLSTDIR)/%.o) | ||
|
||
# Compiler flags to generate dependency files. | ||
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d | ||
|
||
# Combine all necessary flags and optional flags. | ||
# Add target processor to flags. | ||
ALL_CFLAGS = -I. $(CFLAGS) $(GENDEPFLAGS) | ||
|
||
# Default target. | ||
all: begin gccversion buildinfo build end | ||
|
||
|
||
build: tgt | ||
|
||
tgt: $(TARGET) | ||
|
||
# Eye candy. | ||
# the following magic strings to be generated by the compile job. | ||
begin: | ||
@echo | ||
@echo $(MSG_BEGIN) | ||
|
||
end: | ||
@cat build_date.inc | ||
@echo $(MSG_END) | ||
@echo | ||
|
||
# Gather information about build | ||
buildinfo: | ||
@$(CC) --version | grep gcc | awk '{print "\x22" $$0 "\x22"}' > gcc_version.inc | ||
@date --iso-8601=seconds -u | awk '{print "\x22" $$0 "\x22"}' > build_date.inc | ||
@read LASTNUM < build_number.inc; \ | ||
NEWNUM=$$(($$LASTNUM + 1)); \ | ||
echo "$$NEWNUM" > build_number.inc | ||
@touch version.c | ||
|
||
# Display compiler version information. | ||
gccversion : | ||
@$(CC) --version | ||
|
||
|
||
# Link: create output file from object files. | ||
.SECONDARY : $(TARGET) | ||
.PRECIOUS : $(OBJ) | ||
$(TARGET): $(OBJ) | ||
@echo | ||
@echo $(MSG_LINKING) $@ | ||
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) | ||
|
||
# Compile: create object files from C source files. | ||
$(OBJLSTDIR)/%.o : %.c | ||
@echo | ||
@echo $(MSG_COMPILING) $< | ||
$(CC) -c $(ALL_CFLAGS) $< -o $@ | ||
|
||
# Target: clean project. | ||
clean: begin clean_list end | ||
|
||
clean_list : | ||
@echo | ||
@echo $(MSG_CLEANING) | ||
$(REMOVE) $(SRC:%.c=$(OBJLSTDIR)/%.o) | ||
$(REMOVE) $(SRC:%.c=$(OBJLSTDIR)/%.lst) | ||
$(REMOVEDIR) .dep | ||
|
||
# Create object files directory | ||
$(shell mkdir $(OBJLSTDIR) 2>/dev/null) | ||
|
||
# Include the dependency files. | ||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) | ||
|
||
# Listing of phony targets. | ||
.PHONY : all begin end buildinfo gccversion build tgt clean clean_list |
Oops, something went wrong.