diff --git a/Makefile b/Makefile index a65253d..55764d7 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC = gcc CFLAGS = -O0 -g3 -Wall LFLAGS = DEPS = protobuf.h -OBJS = testit.o protobuf.o varint.o Test1_protobuf.o Test2_protobuf.o +OBJS = protobuf.o varint.o %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) @@ -10,10 +10,11 @@ OBJS = testit.o protobuf.o varint.o Test1_protobuf.o Test2_protobuf.o test_protobuf: $(OBJS) $(CC) -o $@ $^ $(LFLAGS) -all: test_protobuf - +all: $(OBJS) + cd test; make all; + clean: rm -f *.o - rm -f test_protobuf + cd test; make clean; rebuild: clean all \ No newline at end of file diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..25b5a72 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,19 @@ +CC = gcc +CFLAGS = -O0 -g3 -Wall -I../ +LFLAGS = +DEPS = ../protobuf.h +OBJS = testit.o ../protobuf.o ../varint.o Test1_protobuf.o Test2_protobuf.o + +%.o: %.c $(DEPS) + $(CC) -c -o $@ $< $(CFLAGS) + +test_protobuf: $(OBJS) + $(CC) -o $@ $^ $(LFLAGS) + +all: test_protobuf + +clean: + rm -f *.o + rm -f test_protobuf + +rebuild: clean all \ No newline at end of file diff --git a/Test1_protobuf.c b/test/Test1_protobuf.c similarity index 100% rename from Test1_protobuf.c rename to test/Test1_protobuf.c diff --git a/Test1_protobuf.h b/test/Test1_protobuf.h similarity index 100% rename from Test1_protobuf.h rename to test/Test1_protobuf.h diff --git a/Test2_protobuf.c b/test/Test2_protobuf.c similarity index 100% rename from Test2_protobuf.c rename to test/Test2_protobuf.c diff --git a/Test2_protobuf.h b/test/Test2_protobuf.h similarity index 100% rename from Test2_protobuf.h rename to test/Test2_protobuf.h diff --git a/test_protobuf.h b/test/test_protobuf.h similarity index 100% rename from test_protobuf.h rename to test/test_protobuf.h diff --git a/test_varint.h b/test/test_varint.h similarity index 100% rename from test_varint.h rename to test/test_varint.h diff --git a/testit.c b/test/testit.c similarity index 100% rename from testit.c rename to test/testit.c