diff mbox

[3/4] Makefile: rename debug/sparse as sparse-dbg during

Message ID CANeU7Q=cmugEO696EKuK72Fpdmr4Lt3M0EKRAhNR=qHYzf_tPA@mail.gmail.com (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Christopher Li Aug. 13, 2017, 7:10 p.m. UTC
debug/sparse have conflict with release version of sparse
on install target.

Rename debug/sparse as sparse-dbg during install.

Signed-off-by: Christopher Li <sparse@chrisli.org>
---
 Makefile | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)


@@ -194,6 +202,7 @@ install: all-installable
  $(Q)install -d $(DESTDIR)$(INCLUDEDIR)/sparse
  $(Q)install -d $(DESTDIR)$(PKGCONFIGDIR)
  $(foreach f,$(INST_PROGRAMS),$(call INSTALL_EXEC,$f,$(BINDIR)))
+ $(foreach f,$(REL_PROGRAMS),$(call INSTALL_DBG,$f,$(BINDIR)))
  $(foreach f,$(INST_MAN1),$(call INSTALL_FILE,$f,$(MAN1DIR)))
  $(foreach f,$(LIBS),$(call INSTALL_FILE,$f,$(LIBDIR)))
  $(foreach f,$(LIB_H),$(call INSTALL_FILE,$f,$(INCLUDEDIR)/sparse))
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 4c89e4c..9db6b15 100644
--- a/Makefile
+++ b/Makefile
@@ -155,10 +155,16 @@  QUIET_INST_SH = $(Q:@=echo -n  '     INSTALL  ';)
 QUIET_INST    = $(Q:@=@echo -n '     INSTALL  ';)

 define INSTALL_EXEC
- $(QUIET_INST)install -v $1 $(DESTDIR)$2/$1 || exit 1;
+ $(QUIET_INST)install -v $1 $(DESTDIR)$2/$(notdir $1) || exit 1;

 endef

+define INSTALL_DBG
+ $(QUIET_INST)install -v debug/$1 $(DESTDIR)$2/$(notdir $1)-dbg || exit 1;
+
+endef
+
+
 define INSTALL_FILE
  $(QUIET_INST)install -v -m 644 $1 $(DESTDIR)$2/$1 || exit 1;

@@ -180,10 +186,12 @@  DBG_LIBS := $(DBG_LIB_FILE)
 REL_OBJS :=  $(LIB_OBJS) $(foreach @F,$(PROGRAMS),$(@F).o $(EXTRA_OBJS))
 DBG_OBJS :=  $(DBG_LIB_OBJS) $(foreach @F,$(PROGRAMS),debug/$(@F).o
$(EXTRA_OBJS))
 ALL_OBJS := $(REL_OBJS) $(DBG_OBJS)
-INST_PROGRAMS += $(PROGRAMS) $(DBG_PROGRAMS)
+ALL_PROGRAMS := $(REL_PROGRAMS) $(DBG_PROGRAMS)

+INST_PROGRAMS += $(REL_PROGRAMS) \
+ $(filter-out $(addprefix debug/,$(REL_PROGRAMS)),$(DBG_PROGRAMS))

-all: $(REL_PROGRAMS) $(DBG_PROGRAMS) sparse.pc
+all: $(ALL_PROGRAMS) sparse.pc

 all-installable: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc