From bcb8333e6fa3443c3bdf5786eca460cd19b63d03 Mon Sep 17 00:00:00 2001 From: pancake Date: Sun, 30 May 2021 23:46:58 +0200 Subject: [PATCH] Improve output for make -s and fix magic install with symlinks issue (#18781) --- Makefile | 1 + global.mk | 6 ++++-- libr/count.sh | 10 ++++++++++ libr/magic/Makefile | 8 +++++--- libr/magic/d/Makefile | 5 +++-- libr/magic/deps.mk | 3 +-- 6 files changed, 24 insertions(+), 9 deletions(-) create mode 100755 libr/count.sh diff --git a/Makefile b/Makefile index 484ac9d2a4..933999e686 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ endif endif all: plugins.cfg libr/include/r_version.h + libr/count.sh reset ${MAKE} -C shlr sdbs ${MAKE} -C shlr/zip ${MAKE} -C libr/util diff --git a/global.mk b/global.mk index 92f535fca9..fcc36313d9 100644 --- a/global.mk +++ b/global.mk @@ -39,9 +39,11 @@ endif .c.o: ifneq ($(SILENT),) - @echo "CC $(shell basename $<)" -endif + @echo "[$(shell $(LIBR)/count.sh)] CC $<" + @$(CC) -c $(CFLAGS) -o $@ $< +else $(CC) -c $(CFLAGS) -o $@ $< +endif -include $(TOP)/config-user.mk -include $(TOP)/mk/platform.mk diff --git a/libr/count.sh b/libr/count.sh new file mode 100755 index 0000000000..262a1a464a --- /dev/null +++ b/libr/count.sh @@ -0,0 +1,10 @@ +#!/bin/sh +if [ -n "$1" ]; then + echo 0 > /tmp/.cc.txt + N=0 +else + N=`cat /tmp/.cc.txt 2> /dev/null` +fi +N=$(($N+1)) +basename `pwd` +echo $N | tee /tmp/.cc.txt diff --git a/libr/magic/Makefile b/libr/magic/Makefile index 9fb04dcee2..95fa145e12 100644 --- a/libr/magic/Makefile +++ b/libr/magic/Makefile @@ -3,19 +3,21 @@ include $(LTOP)/config.mk NAME=r_magic R2DEPS=r_util -PCLIBS=@LIBMAGIC@ CFLAGS+=-I. OBJS=apprentice.o ascmagic.o fsmagic.o funcs.o is_tar.o magic.o softmagic.o +PCLIBS=@LIBMAGIC@ + +alle: all include deps.mk - -include $(LTOP)/rules.mk +include ../rules.mk libfile.a: ${CC} -c ${CFLAGS} ${SRC} ${AR} q libfile.a *.o ${RANLIB} libfile.a + BIN=file${EXT_EXE} ${BIN}: ${CC} -I../include ${CFLAGS} ${SRC} file.c -o ${BIN} diff --git a/libr/magic/d/Makefile b/libr/magic/d/Makefile index d7ce72c0aa..96d5028244 100644 --- a/libr/magic/d/Makefile +++ b/libr/magic/d/Makefile @@ -2,10 +2,11 @@ include ../../config.mk MAGICDIR=${DESTDIR}${DATADIR}/radare2/${VERSION}/magic +all: $(F_SDB) + install: ${F_SDB} - -rm -rf "$(MAGICDIR)" mkdir -p "$(MAGICDIR)" - cp -f default/* "${MAGICDIR}" + for a in default/* ; do readlink "$(MAGICDIR)"; if [ $$? != 0 ]; then cp -f $$a "${MAGICDIR}" ; fi ; done CWD=$(shell pwd) symstall install-symlink: ${F_SDB} diff --git a/libr/magic/deps.mk b/libr/magic/deps.mk index aa86ed37b4..2640f5e9a1 100644 --- a/libr/magic/deps.mk +++ b/libr/magic/deps.mk @@ -1,4 +1,3 @@ -ifeq (${USE_LIB_MAGIC},1) +ifeq ($(USE_LIB_MAGIC),1) LDFLAGS+=-lmagic endif -