Laurence Lundblade | 01168ef | 2019-01-21 17:05:47 -0800 | [diff] [blame] | 1 | # Makefile -- UNIX-style make for qcbor as a lib and command line test |
Laurence Lundblade | df1c1cf | 2019-01-17 11:55:05 -0800 | [diff] [blame] | 2 | # |
Laurence Lundblade | 06350ea | 2020-01-27 19:32:40 -0800 | [diff] [blame] | 3 | # Copyright (c) 2018-2020, Laurence Lundblade. All rights reserved. |
Laurence Lundblade | df1c1cf | 2019-01-17 11:55:05 -0800 | [diff] [blame] | 4 | # |
Laurence Lundblade | 01168ef | 2019-01-21 17:05:47 -0800 | [diff] [blame] | 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | # See BSD-3-Clause license in README.md |
| 8 | # |
| 9 | |
Laurence Lundblade | c2b1457 | 2018-11-01 13:07:49 +0700 | [diff] [blame] | 10 | |
Michael Eckel | 5c53133 | 2020-03-02 01:35:30 +0100 | [diff] [blame^] | 11 | CFLAGS=-I inc -I test -Os -Wcast-align -Wall -Werror -pedantic-errors -Wextra -Wshadow -Wparentheses -Wno-conversion -xc -std=c99 |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 12 | |
Laurence Lundblade | df1c1cf | 2019-01-17 11:55:05 -0800 | [diff] [blame] | 13 | QCBOR_OBJ=src/UsefulBuf.o src/qcbor_encode.o src/qcbor_decode.o src/ieee754.o |
Laurence Lundblade | 781fd82 | 2018-10-01 09:37:52 -0700 | [diff] [blame] | 14 | |
Laurence Lundblade | 4d1ecba | 2018-10-12 21:22:30 +0800 | [diff] [blame] | 15 | TEST_OBJ=test/UsefulBuf_Tests.o test/qcbor_encode_tests.o test/qcbor_decode_tests.o test/run_tests.o \ |
Laurence Lundblade | df1c1cf | 2019-01-17 11:55:05 -0800 | [diff] [blame] | 16 | test/float_tests.o test/half_to_double_from_rfc7049.o |
Laurence Lundblade | 781fd82 | 2018-10-01 09:37:52 -0700 | [diff] [blame] | 17 | |
Laurence Lundblade | 2c97883 | 2018-12-13 01:10:21 -0800 | [diff] [blame] | 18 | qcbortest: libqcbor.a $(TEST_OBJ) cmd_line_main.o |
Laurence Lundblade | cd532e4 | 2018-12-17 13:19:45 -0800 | [diff] [blame] | 19 | cc -o $@ $^ libqcbor.a |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 20 | |
Laurence Lundblade | cd532e4 | 2018-12-17 13:19:45 -0800 | [diff] [blame] | 21 | qcbormin: libqcbor.a min_use_main.o |
| 22 | cc -dead_strip -o $@ $^ libqcbor.a |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 23 | |
Laurence Lundblade | c9d3dcf | 2018-12-19 18:11:36 -0800 | [diff] [blame] | 24 | libqcbor.a: $(QCBOR_OBJ) |
Laurence Lundblade | 2c97883 | 2018-12-13 01:10:21 -0800 | [diff] [blame] | 25 | ar -r $@ $^ |
Laurence Lundblade | c2b1457 | 2018-11-01 13:07:49 +0700 | [diff] [blame] | 26 | |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 27 | src/UsefulBuf.o: inc/UsefulBuf.h |
Laurence Lundblade | 781fd82 | 2018-10-01 09:37:52 -0700 | [diff] [blame] | 28 | src/qcbor_decode.o: inc/UsefulBuf.h inc/qcbor.h src/ieee754.h |
| 29 | src/qcbor_encode.o: inc/UsefulBuf.h inc/qcbor.h src/ieee754.h |
Laurence Lundblade | df1c1cf | 2019-01-17 11:55:05 -0800 | [diff] [blame] | 30 | src/iee754.o: src/ieee754.h |
Laurence Lundblade | 781fd82 | 2018-10-01 09:37:52 -0700 | [diff] [blame] | 31 | |
Laurence Lundblade | 4d1ecba | 2018-10-12 21:22:30 +0800 | [diff] [blame] | 32 | test/run_tests.o: test/UsefulBuf_Tests.h test/float_tests.h test/run_tests.h test/qcbor_encode_tests.h\ |
Laurence Lundblade | df1c1cf | 2019-01-17 11:55:05 -0800 | [diff] [blame] | 33 | test/qcbor_decode_tests.h |
Laurence Lundblade | 4d1ecba | 2018-10-12 21:22:30 +0800 | [diff] [blame] | 34 | test/UsefulBuf_Tests.o: test/UsefulBuf_Tests.h inc/qcbor.h inc/UsefulBuf.h |
| 35 | test/qcbor_encode_tests.o: test/qcbor_encode_tests.h inc/qcbor.h inc/UsefulBuf.h |
| 36 | test/qcbor_decode_tests.o: test/qcbor_decode_tests.h inc/qcbor.h inc/UsefulBuf.h |
| 37 | test/float_tests.o: inc/qcbor.h inc/UsefulBuf.h test/float_tests.h test/half_to_double_from_rfc7049.h |
Laurence Lundblade | 781fd82 | 2018-10-01 09:37:52 -0700 | [diff] [blame] | 38 | test/half_to_double_from_rfc7049.o: test/half_to_double_from_rfc7049.h |
| 39 | |
Laurence Lundblade | 972e59c | 2018-11-11 15:57:23 +0700 | [diff] [blame] | 40 | cmd_line_main.o: test/run_tests.h inc/qcbor.h |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 41 | |
Laurence Lundblade | c2b1457 | 2018-11-01 13:07:49 +0700 | [diff] [blame] | 42 | min_use_main.o: inc/qcbor.h inc/UsefulBuf.h |
| 43 | |
Michael Eckel | 5c53133 | 2020-03-02 01:35:30 +0100 | [diff] [blame^] | 44 | ifeq ($(PREFIX),) |
| 45 | PREFIX := /usr/local |
| 46 | endif |
| 47 | |
| 48 | install: libqcbor.a |
| 49 | install -d $(DESTDIR)$(PREFIX)/lib/ |
| 50 | install -m 644 libqcbor.a $(DESTDIR)$(PREFIX)/lib/ |
| 51 | install -d $(DESTDIR)$(PREFIX)/include/qcbor |
| 52 | install -m 644 inc/qcbor/qcbor.h $(DESTDIR)$(PREFIX)/include/qcbor |
| 53 | install -m 644 inc/qcbor/UsefulBuf.h $(DESTDIR)$(PREFIX)/include/qcbor |
| 54 | |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 55 | clean: |
Laurence Lundblade | b26de6f | 2019-01-10 08:47:40 -0800 | [diff] [blame] | 56 | rm -f $(QCBOR_OBJ) $(TEST_OBJ) libqcbor.a min_use_main.o cmd_line_main.o |