summaryrefslogtreecommitdiffstats
path: root/t/unit-tests/clar/test/Makefile
blob: 93c6b2ad32c2ce610145eb2ecc970afcc71c5352 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# Copyright (c) Vicent Marti. All rights reserved.
#
# This file is part of clar, distributed under the ISC license.
# For full terms see the included COPYING file.
#

#
# Set up the path to the clar sources and to the fixtures directory
#
# The fixture path needs to be an absolute path so it can be used
# even after we have chdir'ed into the test directory while testing.
#
CURRENT_MAKEFILE  := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
TEST_DIRECTORY    := $(abspath $(dir $(CURRENT_MAKEFILE)))
CLAR_PATH         := $(dir $(TEST_DIRECTORY))
CLAR_FIXTURE_PATH := $(TEST_DIRECTORY)/resources/

CFLAGS=-g -I.. -I. -Wall -DCLAR_FIXTURE_PATH=\"$(CLAR_FIXTURE_PATH)\"

.PHONY: clean

# list the objects that go into our test
objects = main.o sample.o

# build the test executable itself
clar_test: $(objects) clar_test.h clar.suite $(CLAR_PATH)clar.c
	$(CC) $(CFLAGS) -o $@ "$(CLAR_PATH)clar.c" $(objects)

# test object files depend on clar macros
$(objects) : $(CLAR_PATH)clar.h

# build the clar.suite file of test metadata
clar.suite:
	python "$(CLAR_PATH)generate.py" .

# remove all generated files
clean:
	$(RM) -rf *.o clar.suite .clarcache clar_test clar_test.dSYM