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 2018 Jason King.
  14 # Copyright 2019 Joyent, Inc.
  15 #
  16 
  17 include $(SRC)/Makefile.master
  18 include $(SRC)/cmd/Makefile.cmd
  19 include $(SRC)/cmd/Makefile.ctf
  20 include $(SRC)/test/Makefile.com
  21 
  22 ROOTBINDIR = $(ROOTOPTPKG)/bin
  23 
  24 PROG = cxx rust
  25 
  26 OBJS_common = main.o
  27 OBJS_rust = rust.o
  28 OBJS_cxx = afl-fast.o gcc-libstdc++.o llvm-stdcxxabi.o
  29 
  30 ROOTOPTPKG = $(ROOT)/opt/util-tests
  31 TESTDIR = $(ROOTOPTPKG)/tests/demangle
  32 
  33 CMDS = $(PROG:%=$(TESTDIR)/%)
  34 $(CMDS) := FILEMODE = 0555
  35 
  36 cxx := OBJS = $(OBJS_common) $(OBJS_cxx)
  37 rust := OBJS = $(OBJS_common) $(OBJS_cxx)
  38 
  39 $(OBJS_rust) $(OBJS_cxx) := SMATCH = off
  40 
  41 SRCS = $(OBJS:%.o=%.c)
  42 
  43 CSTD = $(CSTD_GNU99)
  44 
  45 LDLIBS += -ldemangle-sys -lumem
  46 
  47 all: $(PROG)
  48 
  49 cxx: $(OBJS_common) $(OBJS_cxx)
  50         $(LINK.c) -o $@ $(OBJS_common) $(OBJS_cxx) $(LDLIBS)
  51         $(POST_PROCESS)
  52 
  53 rust: $(OBJS_rust)
  54         $(LINK.c) -o $@ $(OBJS_common) $(OBJS_rust) $(LDLIBS)
  55         $(POST_PROCESS)
  56 
  57 install: all $(CMDS)
  58 
  59 clobber: clean
  60         -$(RM) $(PROG)
  61 
  62 clean:
  63         -$(RM) $(OBJ_common) $(OBJS_cxx) $(OBJS_rust)
  64 
  65 $(CMDS): $(TESTDIR) $(PROG)
  66 
  67 $(ROOTBINDIR):
  68         $(INS.dir)
  69 
  70 $(ROOTBINDIR)/%: %
  71         $(INS.file)
  72 
  73 $(TESTDIR):
  74         $(INS.dir)
  75 
  76 $(TESTDIR)/%: %
  77         $(INS.file)