Jeremy Kerr | 4cdc200 | 2019-02-07 16:49:12 +0800 | [diff] [blame] | 1 | |
| 2 | CC = gcc |
| 3 | AR = ar |
| 4 | CFLAGS = -Wall -Wextra -Werror -ggdb |
| 5 | CPPFLAGS = -DMCTP_LOG_STDERR -DMCTP_FILEIO -I$(LIBMCTP_DIR) |
| 6 | |
| 7 | LIBMCTP_DIR=./ |
| 8 | |
| 9 | include Makefile.inc |
| 10 | |
| 11 | all: $(LIBMCTP) |
| 12 | |
| 13 | libmctp.a: |
| 14 | $(AR) rcsTPD $@ $^ |
| 15 | |
Jeremy Kerr | bd4e362 | 2019-03-13 15:20:42 +0800 | [diff] [blame] | 16 | utils/%: utils/%.o libmctp.a |
Jeremy Kerr | 4cdc200 | 2019-02-07 16:49:12 +0800 | [diff] [blame] | 17 | $(LINK.o) -o $@ $^ |
| 18 | |
Jeremy Kerr | 1892511 | 2019-03-13 15:43:08 +0800 | [diff] [blame] | 19 | test_util_objs = tests/test-utils.o |
| 20 | |
Jeremy Kerr | ba07694 | 2019-03-13 16:20:34 +0800 | [diff] [blame] | 21 | tests = test_eid test_seq |
Jeremy Kerr | 1892511 | 2019-03-13 15:43:08 +0800 | [diff] [blame] | 22 | |
| 23 | test_targets = $(tests:%=tests/%) |
| 24 | |
| 25 | $(test_targets): $(test_util_objs) libmctp.a |
| 26 | |
| 27 | $(test_targets): %: %.o |
| 28 | $(LINK.o) -o $@ $^ |
| 29 | |
| 30 | check: $(test_targets) |
| 31 | for t in $(test_targets); do echo $$t; $$t || exit 1; done |
| 32 | |
| 33 | .PHONY: check |
| 34 | |
Jeremy Kerr | 4cdc200 | 2019-02-07 16:49:12 +0800 | [diff] [blame] | 35 | clean: |
| 36 | rm -f $(LIBMCTP) |
| 37 | rm -f $(LIBMCTP_OBJS) |
| 38 | rm -f tests/*.o |