Makefile: wire up test/ directory for compilation
authorBrian Norris <banorris@uci.edu>
Thu, 2 Aug 2012 23:36:29 +0000 (16:36 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 2 Aug 2012 23:40:02 +0000 (16:40 -0700)
Makefile
test/Makefile [new file with mode: 0644]

index 6a85ee8d2a611c803ce431c2a3267f6fd3b3f7b4..c2d7072e4c5170344cea19d35467aa537303f9cf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,9 @@ CPPFLAGS += -Iinclude -I.
 LDFLAGS=-ldl -lrt
 SHARED=-shared
 
-all: $(LIB_SO)
+TESTS=test
+
+all: $(LIB_SO) tests
 
 debug: CPPFLAGS += -DCONFIG_DEBUG
 debug: all
@@ -42,9 +44,13 @@ snapshot.o: mymemory.h snapshot.h snapshotimp.h snapshot.cc
 
 clean:
        rm -f *.o *.so
+       $(MAKE) -C $(TESTS) clean
 
 mrclean: clean
        rm -rf docs
 
 tags::
        ctags -R
+
+tests:: $(LIB_SO)
+       $(MAKE) -C $(TESTS)
diff --git a/test/Makefile b/test/Makefile
new file mode 100644 (file)
index 0000000..f7a01be
--- /dev/null
@@ -0,0 +1,15 @@
+include ../common.mk
+
+CPPFLAGS += -I.. -I../include
+TESTS=userprog
+
+SRCS = $(wildcard *.c)
+OBJS = $(patsubst %.c,%.o,$(SRCS))
+
+all: $(OBJS)
+
+%.o: %.c
+       $(CC) -o $@ $< $(CPPFLAGS) -L.. -l$(LIB_NAME)
+
+clean::
+       rm -f *.o $(TESTS)