public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org
Subject: [committed] Factor out common flags between dwz and dwz-for-test
Date: Fri, 9 Apr 2021 17:14:08 +0200	[thread overview]
Message-ID: <20210409151356.GA21560@delia> (raw)

Hi,

Add new CFLAGS_* and LIBS variables to factor out commonality between
dwz and dwz-for-test compilations.

Committed to trunk.

Thanks,
- Tom

Factor out common flags between dwz and dwz-for-test

2021-04-09  Tom de Vries  <tdevries@suse.de>

	* Makefile (CFLAGS_VERSION, CFLAGS_COPYRIGHT, CFLAGS_COMMON, LIBS):
	New variables.
	(CFLAGS, dwz, dwz-for-test): Use new vars.

---
 Makefile | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index c23c36f..c3a5abe 100644
--- a/Makefile
+++ b/Makefile
@@ -3,18 +3,23 @@ VPATH = $(srcdir)
 else
 srcdir=$(shell pwd)
 endif
+
 CFLAGS = -O2 -g
 DWZ_VERSION := $(shell cat $(srcdir)/VERSION)
-override CFLAGS += -Wall -W -D_FILE_OFFSET_BITS=64 \
-	-DDWZ_VERSION='"$(DWZ_VERSION)"' $(shell cat $(srcdir)/COPYRIGHT_YEARS)
+CFLAGS_VERSION = -DDWZ_VERSION='"$(DWZ_VERSION)"'
+CFLAGS_COPYRIGHT = $(shell cat $(srcdir)/COPYRIGHT_YEARS)
+CFLAGS_COMMON = -Wall -W -D_FILE_OFFSET_BITS=64
+override CFLAGS += $(CFLAGS_COMMON) $(CFLAGS_VERSION) $(CFLAGS_COPYRIGHT)
+
 prefix = /usr
 exec_prefix = $(prefix)
 bindir = $(exec_prefix)/bin
 datarootdir = $(prefix)/share
 mandir = $(datarootdir)/man
 OBJECTS = args.o dwz.o hashtab.o sha1.o dwarfnames.o
+LIBS=-lelf
 dwz: $(OBJECTS)
-	$(CC) $(LDFLAGS) -o $@ $^ -lelf
+	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 install: dwz
 	install -D dwz $(DESTDIR)$(bindir)/dwz
 	install -D -m 644 $(srcdir)/dwz.1 $(DESTDIR)$(mandir)/man1/dwz.1
@@ -56,9 +61,8 @@ DWZ_TEST_SOURCES := $(patsubst %.o,%-for-test.c,$(OBJECTS))
 	sed 's/__GNUC__/NOT_DEFINED/' $< > $@
 
 dwz-for-test: $(DWZ_TEST_SOURCES)
-	$(CC) $(DWZ_TEST_SOURCES) -O2 -g -lelf -o $@ -Wall -W -DDEVEL \
-	  -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"for-test"' -I$(srcdir) \
-	  $(shell cat $(srcdir)/COPYRIGHT_YEARS)
+	$(CC) $(DWZ_TEST_SOURCES) -O2 -g $(LIBS) -o $@ $(CFLAGS_COMMON) \
+	  -DDEVEL -DDWZ_VERSION='"for-test"' -I$(srcdir) $(CFLAGS_COPYRIGHT)
 
 min:
 	$(CC) $(TEST_SRC)/min.c $(TEST_SRC)/min-2.c -o $@ -g

                 reply	other threads:[~2021-04-09 15:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210409151356.GA21560@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).