[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Macro question

From: Gisle Vanem
Subject: Macro question
Date: Wed, 9 Dec 2015 16:19:39 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

I have a question regarding a GNU-make macro like this
(which I use to link a MSVC .dll):

  define do_link_DLL
    link $(LDFLAGS) -dll -out:$(1) -implib:$(2) \
         -pdb:$(1:.dll=.pdb) -map:$(1:.dll=.map) $(3) > link.tmp
    cat link.tmp >> $(1:.dll=.map)
    rm -f $(2:.lib=.exp) link.tmp

Using this as (in a Wireshark makefile):

  wiretap.dll: $(WIRETAP_OBJ)
     $(call do_link_DLL,wiretap.dll,wiretap_imp.lib, $^ $(EXTRA_LIBS))

AFAICS, if the 'link' stage fails, the rule continues to the 'cat' + 'rm' part
regardless. But from gmake's perspective all the commands succeeds (since
cat+rm returns 0). No?

How can I define my macro for gmake to quit on 'link' error?
Can the macro be written into a Perl-like:
  exec("link $args") || die "link failed";

If so, how?

PS. Since I have '-verbose' in LDFLAGS, it is handy to redirect those
  (error) messages into 'link.tmp' in case of a link-failure.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]