diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-24 10:56:35 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-24 10:56:35 -0500 |
commit | bc1baf25a0844861713829c0e9e69e4a2d447cc6 (patch) | |
tree | 37ad821656ffa979248f6154573f5cd9f30932a3 /Makefile |
Initial commit, pulled from openxc/vi-firmware.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..8385c3ac --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +CC = gcc +INCLUDES = -Isrc +CFLAGS = $(INCLUDES) -c -w -Wall -Werror -g -ggdb +LDFLAGS = +LDLIBS = -lcheck + +TEST_DIR = tests + +# Guard against \r\n line endings only in Cygwin +OSTYPE := $(shell uname) +ifneq ($(OSTYPE),Darwin) + OSTYPE := $(shell uname -o) + ifeq ($(OSTYPE),Cygwin) + TEST_SET_OPTS = igncr + endif +endif + +SRC = $(wildcard src/**/*.c) +OBJS = $(SRC:.c=.o) +TEST_SRC = $(wildcard $(TEST_DIR)/*.c) +TEST_OBJS = $(TEST_SRC:.c=.o) + +all: $(OBJS) + +test: $(TEST_DIR)/tests.bin + @set -o $(TEST_SET_OPTS) >/dev/null 2>&1 + @export SHELLOPTS + @sh runtests.sh $(TEST_DIR) + +$(TEST_DIR)/tests.bin: $(TEST_OBJS) $(OBJS) + @mkdir -p $(dir $@) + $(CC) $(LDFLAGS) $(CC_SYMBOLS) $(INCLUDES) -o $@ $^ $(LDLIBS) + +clean: + rm -rf **/*.o $(TEST_DIR)/*.bin |