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 | |
Laurence Lundblade | 844bb5c | 2020-03-01 17:27:25 -0800 | [diff] [blame] | 11 | CC=cc |
| 12 | |
Laurence Lundblade | f19f4da | 2020-03-01 17:41:53 -0800 | [diff] [blame] | 13 | CFLAGS=-I inc -I test -Os |
| 14 | |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 15 | |
Laurence Lundblade | 844bb5c | 2020-03-01 17:27:25 -0800 | [diff] [blame] | 16 | |
Laurence Lundblade | df1c1cf | 2019-01-17 11:55:05 -0800 | [diff] [blame] | 17 | 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] | 18 | |
Michael Eckel | 9c42c20 | 2020-03-04 18:26:11 +0100 | [diff] [blame^] | 19 | TEST_OBJ=test/UsefulBuf_Tests.o test/qcbor_encode_tests.o \ |
| 20 | test/qcbor_decode_tests.o test/run_tests.o \ |
| 21 | test/float_tests.o test/half_to_double_from_rfc7049.o |
| 22 | |
| 23 | .PHONY: all install clean |
| 24 | |
| 25 | all: qcbortest qcbormin libqcbor.a |
Laurence Lundblade | 781fd82 | 2018-10-01 09:37:52 -0700 | [diff] [blame] | 26 | |
Laurence Lundblade | 2c97883 | 2018-12-13 01:10:21 -0800 | [diff] [blame] | 27 | qcbortest: libqcbor.a $(TEST_OBJ) cmd_line_main.o |
Laurence Lundblade | 844bb5c | 2020-03-01 17:27:25 -0800 | [diff] [blame] | 28 | $(CC) -o $@ $^ libqcbor.a |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 29 | |
Laurence Lundblade | cd532e4 | 2018-12-17 13:19:45 -0800 | [diff] [blame] | 30 | qcbormin: libqcbor.a min_use_main.o |
Laurence Lundblade | 844bb5c | 2020-03-01 17:27:25 -0800 | [diff] [blame] | 31 | $(CC) -dead_strip -o $@ $^ libqcbor.a |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 32 | |
Laurence Lundblade | c9d3dcf | 2018-12-19 18:11:36 -0800 | [diff] [blame] | 33 | libqcbor.a: $(QCBOR_OBJ) |
Laurence Lundblade | 2c97883 | 2018-12-13 01:10:21 -0800 | [diff] [blame] | 34 | ar -r $@ $^ |
Laurence Lundblade | c2b1457 | 2018-11-01 13:07:49 +0700 | [diff] [blame] | 35 | |
Michael Eckel | 9c42c20 | 2020-03-04 18:26:11 +0100 | [diff] [blame^] | 36 | 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 |
Laurence Lundblade | 844bb5c | 2020-03-01 17:27:25 -0800 | [diff] [blame] | 37 | |
Michael Eckel | 9c42c20 | 2020-03-04 18:26:11 +0100 | [diff] [blame^] | 38 | src/UsefulBuf.o: inc/qcbor/UsefulBuf.h |
| 39 | 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 |
| 40 | 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 |
| 41 | src/iee754.o: src/ieee754.h |
Laurence Lundblade | 781fd82 | 2018-10-01 09:37:52 -0700 | [diff] [blame] | 42 | |
Michael Eckel | 9c42c20 | 2020-03-04 18:26:11 +0100 | [diff] [blame^] | 43 | 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] | 44 | test/qcbor_decode_tests.h |
Michael Eckel | 9c42c20 | 2020-03-04 18:26:11 +0100 | [diff] [blame^] | 45 | test/UsefulBuf_Tests.o: test/UsefulBuf_Tests.h inc/qcbor/UsefulBuf.h |
| 46 | test/qcbor_encode_tests.o: test/qcbor_encode_tests.h $(PUBLIC_INTERFACE) |
| 47 | test/qcbor_decode_tests.o: test/qcbor_decode_tests.h $(PUBLIC_INTERFACE) |
| 48 | test/float_tests.o: test/float_tests.h test/half_to_double_from_rfc7049.h $(PUBLIC_INTERFACE) |
| 49 | test/half_to_double_from_rfc7049.o: test/half_to_double_from_rfc7049.h |
Laurence Lundblade | 781fd82 | 2018-10-01 09:37:52 -0700 | [diff] [blame] | 50 | |
Michael Eckel | 9c42c20 | 2020-03-04 18:26:11 +0100 | [diff] [blame^] | 51 | cmd_line_main.o: test/run_tests.h $(PUBLIC_INTERFACE) |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 52 | |
Michael Eckel | 9c42c20 | 2020-03-04 18:26:11 +0100 | [diff] [blame^] | 53 | min_use_main.o: $(PUBLIC_INTERFACE) |
Laurence Lundblade | c2b1457 | 2018-11-01 13:07:49 +0700 | [diff] [blame] | 54 | |
Michael Eckel | 5c53133 | 2020-03-02 01:35:30 +0100 | [diff] [blame] | 55 | ifeq ($(PREFIX),) |
| 56 | PREFIX := /usr/local |
| 57 | endif |
| 58 | |
Michael Eckel | 9c42c20 | 2020-03-04 18:26:11 +0100 | [diff] [blame^] | 59 | install: libqcbor.a $(PUBLIC_INTERFACE) |
Michael Eckel | 5c53133 | 2020-03-02 01:35:30 +0100 | [diff] [blame] | 60 | install -d $(DESTDIR)$(PREFIX)/lib/ |
| 61 | install -m 644 libqcbor.a $(DESTDIR)$(PREFIX)/lib/ |
| 62 | install -d $(DESTDIR)$(PREFIX)/include/qcbor |
Laurence Lundblade | 844bb5c | 2020-03-01 17:27:25 -0800 | [diff] [blame] | 63 | install -m 644 inc/qcbor.h $(DESTDIR)$(PREFIX)/include/qcbor |
| 64 | install -m 644 inc/qcbor/qcbor_private.h $(DESTDIR)$(PREFIX)/include/qcbor |
| 65 | install -m 644 inc/qcbor/qcbor_common.h $(DESTDIR)$(PREFIX)/include/qcbor |
| 66 | install -m 644 inc/qcbor/qcbor_decode.h $(DESTDIR)$(PREFIX)/include/qcbor |
| 67 | install -m 644 inc/qcbor/qcbor_encode.h $(DESTDIR)$(PREFIX)/include/qcbor |
Michael Eckel | 5c53133 | 2020-03-02 01:35:30 +0100 | [diff] [blame] | 68 | install -m 644 inc/qcbor/UsefulBuf.h $(DESTDIR)$(PREFIX)/include/qcbor |
| 69 | |
Laurence Lundblade | 74d265c | 2018-09-19 10:21:00 -0700 | [diff] [blame] | 70 | clean: |
Laurence Lundblade | b26de6f | 2019-01-10 08:47:40 -0800 | [diff] [blame] | 71 | rm -f $(QCBOR_OBJ) $(TEST_OBJ) libqcbor.a min_use_main.o cmd_line_main.o |