split qcbor.h into four separate headers (#34)
This is to make it much easier to read the header files.
Backwards compatibility with qcbor.h is retained, but use of qcbor/qcbor_encode.h and qcbor/qcbor_decode.h is preferred now.
Signed-off-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/Makefile b/Makefile
index 657cd95..91220aa 100644
--- a/Makefile
+++ b/Makefile
@@ -8,38 +8,43 @@
#
+CC=cc
+
CFLAGS=-I inc -I test -Os -Wcast-align -Wall -Werror -pedantic-errors -Wextra -Wshadow -Wparentheses -Wno-conversion -xc -std=c99
+
QCBOR_OBJ=src/UsefulBuf.o src/qcbor_encode.o src/qcbor_decode.o src/ieee754.o
TEST_OBJ=test/UsefulBuf_Tests.o test/qcbor_encode_tests.o test/qcbor_decode_tests.o test/run_tests.o \
test/float_tests.o test/half_to_double_from_rfc7049.o
qcbortest: libqcbor.a $(TEST_OBJ) cmd_line_main.o
- cc -o $@ $^ libqcbor.a
+ $(CC) -o $@ $^ libqcbor.a
qcbormin: libqcbor.a min_use_main.o
- cc -dead_strip -o $@ $^ libqcbor.a
+ $(CC) -dead_strip -o $@ $^ libqcbor.a
libqcbor.a: $(QCBOR_OBJ)
ar -r $@ $^
+PUBLIC_INTERFACE=inc/qcbor/Usefulbuf.h inc/qcbor/qcbor_private.h inc/qcbor/qcbor_common.h inc/qcbor/qcbor_encode.h inc/qcbor/qcbor_decode.h
+
src/UsefulBuf.o: inc/UsefulBuf.h
-src/qcbor_decode.o: inc/UsefulBuf.h inc/qcbor.h src/ieee754.h
-src/qcbor_encode.o: inc/UsefulBuf.h inc/qcbor.h src/ieee754.h
+src/qcbor_decode.o: inc/qcbor/UsefulBuf.h inc/qcbor/qcbor_private.h inc/qcbor/qcbor_common.h inc/qcbor/qcbor_encode.h src/ieee754.h
+src/qcbor_encode.o: inc/qcbor/UsefulBuf.h inc/qcbor/qcbor_private.h inc/qcbor/qcbor_common.h inc/qcbor/qcbor_decode.h src/ieee754.h
src/iee754.o: src/ieee754.h
test/run_tests.o: test/UsefulBuf_Tests.h test/float_tests.h test/run_tests.h test/qcbor_encode_tests.h\
test/qcbor_decode_tests.h
-test/UsefulBuf_Tests.o: test/UsefulBuf_Tests.h inc/qcbor.h inc/UsefulBuf.h
-test/qcbor_encode_tests.o: test/qcbor_encode_tests.h inc/qcbor.h inc/UsefulBuf.h
-test/qcbor_decode_tests.o: test/qcbor_decode_tests.h inc/qcbor.h inc/UsefulBuf.h
-test/float_tests.o: inc/qcbor.h inc/UsefulBuf.h test/float_tests.h test/half_to_double_from_rfc7049.h
+test/UsefulBuf_Tests.o: test/UsefulBuf_Tests.h inc/UsefulBuf.h
+test/qcbor_encode_tests.o: test/qcbor_encode_tests.h $(PUBLIC_INTERFACE)
+test/qcbor_decode_tests.o: test/qcbor_decode_tests.h $(PUBIC_INTERFACE)
+test/float_tests.o: test/float_tests.h test/half_to_double_from_rfc7049.h $(PUBLIC_INTERFACE)
test/half_to_double_from_rfc7049.o: test/half_to_double_from_rfc7049.h
-cmd_line_main.o: test/run_tests.h inc/qcbor.h
+cmd_line_main.o: test/run_tests.h $(PUBLIC_INTERFACE)
-min_use_main.o: inc/qcbor.h inc/UsefulBuf.h
+min_use_main.o: $(PUBLIC_INTERFACE)
ifeq ($(PREFIX),)
PREFIX := /usr/local
@@ -49,7 +54,11 @@
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 libqcbor.a $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/qcbor
- install -m 644 inc/qcbor/qcbor.h $(DESTDIR)$(PREFIX)/include/qcbor
+ install -m 644 inc/qcbor.h $(DESTDIR)$(PREFIX)/include/qcbor
+ install -m 644 inc/qcbor/qcbor_private.h $(DESTDIR)$(PREFIX)/include/qcbor
+ install -m 644 inc/qcbor/qcbor_common.h $(DESTDIR)$(PREFIX)/include/qcbor
+ install -m 644 inc/qcbor/qcbor_decode.h $(DESTDIR)$(PREFIX)/include/qcbor
+ install -m 644 inc/qcbor/qcbor_encode.h $(DESTDIR)$(PREFIX)/include/qcbor
install -m 644 inc/qcbor/UsefulBuf.h $(DESTDIR)$(PREFIX)/include/qcbor
clean: