diff options
author | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-27 11:22:56 -0500 |
---|---|---|
committer | Christopher Peplin <chris.peplin@rhubarbtech.com> | 2013-12-27 11:22:56 -0500 |
commit | 9dafed6b7fe2fe45f44aa8c614d51388f84bb696 (patch) | |
tree | 5696061f4887685a27f46d1f505f98cff9f1f926 /Makefile |
Initial commit with blank structure.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..49e22f2c --- /dev/null +++ b/Makefile @@ -0,0 +1,36 @@ +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) +TESTS=$(patsubst %.c,%.bin,$(TEST_SRC)) + +all: $(OBJS) + +test: $(TESTS) + @set -o $(TEST_SET_OPTS) >/dev/null 2>&1 + @export SHELLOPTS + @sh runtests.sh $(TEST_DIR) + +$(TEST_DIR)/%.bin: $(TEST_DIR)/%.o $(OBJS) + @mkdir -p $(dir $@) + $(CC) $(LDFLAGS) $(CC_SYMBOLS) $(INCLUDES) -o $@ $^ $(LDLIBS) + +clean: + rm -rf **/*.o $(TEST_DIR)/*.bin |