1 # 2 # This file and its contents are supplied under the terms of the 3 # Common Development and Distribution License ("CDDL"), version 1.0. 4 # You may only use this file in accordance with the terms of version 5 # 1.0 of the CDDL. 6 # 7 # A full copy of the text of the CDDL should have accompanied this 8 # source. A copy of the CDDL is also available via the Internet at 9 # http://www.illumos.org/license/CDDL. 10 # 11 12 # 13 # Copyright 2019 Joyent, Inc. 14 # 15 16 # 17 # This Makefile is installed onto the target system and is used as part 18 # of the running tests. It is not used as part of the build. 19 # 20 # This makefile could be simplified substantially. However, it does 21 # everything explicitly to try and work with a wide variety of different 22 # makes. 23 # 24 # The following values should be passed in by the invoker of the 25 # Makefile: 26 # 27 # CC C Compiler to use 28 # CFLAGS32 32-bit CFLAGS 29 # CFLAGS64 64-bit CFLAGS 30 # CTFCONVERT Path to ctfconvert 31 # CTFMERGE Path to ctfmerge 32 # DEBUGFLAGS The set of debug flags to use 33 # BUILDDIR Directory things should be built in 34 # CHECK32 Program to check 32-bit output 35 # CHECK64 Program to check 64-bit output 36 # 37 # The following values should be set before building this: 38 # 39 # TEST The name of the test program 40 # OBJS_C_32 32-bit convert objects 41 # OBJS_C_64 64-bit convert objects 42 # OBJS_M_32 32-bit merge objects 43 # OBJS_M_64 64-bit merge objects 44 # 45 46 CONV32 = $(BUILDDIR)/$(TEST)-32c 47 CONV64 = $(BUILDDIR)/$(TEST)-64c 48 MERGE32 = $(BUILDDIR)/$(TEST)-32m 49 MERGE64 = $(BUILDDIR)/$(TEST)-64m 50 51 BINS = $(CONV32) \ 52 $(CONV64) \ 53 $(MERGE32) \ 54 $(MERGE64) 55 56 build: $(BINS) 57 58 $(BUILDDIR)/%.32.c.o: %.c 59 $(CC) $(CFLAGS32) $(DEBUGFLAGS) -o $@ -c $< 60 61 $(BUILDDIR)/%.64.c.o: %.c 62 $(CC) $(CFLAGS64) $(DEBUGFLAGS) -o $@ -c $< 63 64 $(BUILDDIR)/%.32.m.o: %.c 65 $(CC) $(CFLAGS32) $(DEBUGFLAGS) -o $@ -c $< 66 $(CTFCONVERT) $@ 67 68 $(BUILDDIR)/%.64.m.o: %.c 69 $(CC) $(CFLAGS64) $(DEBUGFLAGS) -o $@ -c $< 70 $(CTFCONVERT) $@ 71 72 $(CONV32): $(OBJS_C_32) 73 $(CC) $(CFLAGS32) $(DEBUGFLAGS) -o $@ $(OBJS_C_32) 74 $(CTFCONVERT) $@ 75 76 $(CONV64): $(OBJS_C_64) 77 $(CC) $(CFLAGS64) $(DEBUGFLAGS) -o $@ $(OBJS_C_64) 78 $(CTFCONVERT) $@ 79 80 $(MERGE32): $(OBJS_M_32) 81 $(CC) $(CFLAGS32) $(DEBUGFLAGS) -o $@ $(OBJS_M_32) 82 $(CTFMERGE) -t -o $@ $(OBJS_M_32) 83 84 $(MERGE64): $(OBJS_M_64) 85 $(CC) $(CFLAGS64) $(DEBUGFLAGS) -o $@ $(OBJS_M_64) 86 $(CTFMERGE) -t -o $@ $(OBJS_M_64) 87 88 run-test: 89 $(CHECK32) $(CONV32) 90 $(CHECK64) $(CONV64) 91 $(CHECK32) $(MERGE32) 92 $(CHECK64) $(MERGE64)