aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2014-05-16 00:03:12 +0300
committerOskari Timperi <oskari.timperi@iki.fi>2014-05-16 00:03:12 +0300
commit8cb320351cfd95acbca06a4f59e79adc70ed52bf (patch)
treec8fc0dcafb9b304b55d48e6da0b3c86e4ec706bb /Makefile
parenta1a0fa8aba7e8a33d5fa6c9ace10338296615edc (diff)
downloadlispish-8cb320351cfd95acbca06a4f59e79adc70ed52bf.tar.gz
lispish-8cb320351cfd95acbca06a4f59e79adc70ed52bf.zip
Makefile: allow building test/repl at the same time (use different object files)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 6 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index c37b196..b520b1b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
SOURCES = parse.c list.c atom.c eval.c tokens.c env.c
OBJECTS = $(SOURCES:.c=.o)
+TEST_OBJECTS = $(foreach obj,$(OBJECTS),test_$(obj))
CFLAGS = -Wall -g
LDFLAGS =
@@ -7,19 +8,18 @@ LDFLAGS =
CC = gcc
LD = gcc
-# ifneq ($(BUILD_TEST),)
+all: test repl
+
+test_%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $^
test: CFLAGS := $(CFLAGS) -DBUILD_TEST
-test: $(OBJECTS) tst_main.o
+test: $(TEST_OBJECTS) tst_main.o
$(LD) $(LDFLAGS) -o $@ $^
-# else
-
repl: $(OBJECTS) repl.o linenoise.o
$(LD) $(LDFLAGS) -o $@ $^
-# endif
-
.PHONY: clean
clean:
rm -f *.o