2018-01-20 22:24:45 +00:00
|
|
|
# Prevent rebuilding
|
|
|
|
VPATH = bin:test:test/results
|
|
|
|
|
|
|
|
all: M2-Planet
|
|
|
|
|
|
|
|
CC=gcc
|
|
|
|
CFLAGS=-D_GNU_SOURCE -O0 -std=c99 -ggdb
|
|
|
|
|
2018-01-21 03:56:50 +00:00
|
|
|
M2-Planet: cc_reader.c cc_strings.c cc_core.c cc.c cc.h | bin
|
|
|
|
$(CC) $(CFLAGS) cc_reader.c cc_strings.c cc_core.c cc.c cc.h -o bin/M2-Planet
|
|
|
|
|
|
|
|
M2-Planet-minimal: cc_reader.c cc_strings.c cc_core.c cc-minimal.c cc.h | bin
|
|
|
|
$(CC) $(CFLAGS) cc_reader.c cc_strings.c cc_core.c cc-minimal.c cc.h -o bin/M2-Planet-minimal
|
2018-01-20 22:24:45 +00:00
|
|
|
|
|
|
|
# Clean up after ourselves
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf bin/ test/results/
|
|
|
|
./test/test0/cleanup.sh
|
2018-01-20 23:21:20 +00:00
|
|
|
./test/test1/cleanup.sh
|
2018-01-21 03:56:50 +00:00
|
|
|
./test/test2/cleanup.sh
|
2018-01-20 22:24:45 +00:00
|
|
|
|
|
|
|
# Directories
|
|
|
|
bin:
|
|
|
|
mkdir -p bin
|
|
|
|
|
|
|
|
results:
|
|
|
|
mkdir -p test/results
|
|
|
|
|
|
|
|
# tests
|
2018-01-21 03:56:50 +00:00
|
|
|
test: test0-binary test1-binary test2-binary | results
|
2018-01-20 22:24:45 +00:00
|
|
|
sha256sum -c test/test.answers
|
|
|
|
|
|
|
|
test0-binary: M2-Planet | results
|
|
|
|
test/test0/hello.sh
|
|
|
|
|
2018-01-20 23:21:20 +00:00
|
|
|
test1-binary: M2-Planet | results
|
|
|
|
test/test1/hello.sh
|
|
|
|
|
2018-01-21 03:56:50 +00:00
|
|
|
test2-binary: M2-Planet | results
|
|
|
|
test/test2/hello.sh
|
|
|
|
|
2018-01-20 22:24:45 +00:00
|
|
|
# Generate test answers
|
|
|
|
.PHONY: Generate-test-answers
|
|
|
|
Generate-test-answers:
|
|
|
|
sha256sum test/results/* >| test/test.answers
|
|
|
|
|
|
|
|
DESTDIR:=
|
|
|
|
PREFIX:=/usr/local
|
|
|
|
bindir:=$(DESTDIR)$(PREFIX)/bin
|
|
|
|
.PHONY: install
|
|
|
|
install: M2-Planet
|
|
|
|
mkdir -p $(bindir)
|
|
|
|
cp $^ $(bindir)
|