public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Factor out common flags between dwz and dwz-for-test
@ 2021-04-09 15:14 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-04-09 15:14 UTC (permalink / raw)
  To: dwz, jakub, mark

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-09 15:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 15:14 [committed] Factor out common flags between dwz and dwz-for-test Tom de Vries

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).