From f9119361be42c041452c6c7e8dae61419cf884eb Mon Sep 17 00:00:00 2001 From: Lauri Leukkunen Date: Tue, 15 Aug 2006 19:14:30 +0300 Subject: * improve pretty printing a lot --- Makefile.include | 51 +++++++++++++++++++++++++++++++-------------------- preload/Makefile | 5 ++--- utils/Makefile | 3 +-- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/Makefile.include b/Makefile.include index 6e248da..baeba85 100644 --- a/Makefile.include +++ b/Makefile.include @@ -43,41 +43,52 @@ ll_subdir: $(subdir_deps) @$(MAKE) --no-print-directory -f $(TOPDIR)/Makefile.build $(built_in_target) $(extra_targets) $(built_in_target): $(obj-default) - @$(pretty_link) + $(pretty_link_builtin) OPT_CURDIR = $(patsubst /%,%,$(strip $(subst $(TOPDIR), , $(CURDIR)))) -define pretty_build_c - build_cmd="$(CC) $(CFLAGS) -Wp,-MD,$(dir $(@))/.$(notdir $(@)).d -o $@ -c $<"; \ - build_output=$$($$build_cmd 2>&1); \ + +define pretty_run + run_output=$$($$run_cmd 2>&1); \ if [ $$? -ne 0 ]; then \ - echo $$build_cmd; echo $(OPT_CURDIR)/$$build_output; \ + echo $$run_cmd; echo $(OPT_CURDIR)/$$run_output; \ false; \ else \ - echo [CC] $(OPT_CURDIR)/$(@:.o=.c); \ - echo "$$build_output" | grep " warning: "; \ + echo [$$run_alias] [$@] $(OPT_CURDIR)/$^; \ + echo "$$run_output" | grep " warning: "; \ true ; \ fi endef -define pretty_link - link_cmd="$(LD) -r -nostartfiles $(LDFLAGS) -o $@ $^"; \ - link_output=$$($$link_cmd 2>&1); \ - if [ $$? -ne 0 ]; then \ - echo $$link_cmd; echo $(OPT_CURDIR)/$$link_output; \ - false; \ - else \ - echo [LD] $(OPT_CURDIR)/$@; \ - echo "$$link_output" | grep " warning: "; \ - true; \ - fi +define pretty_build_c + @run_cmd="$(CC) $(CFLAGS) -Wp,-MD,$(dir $(@))/.$(notdir $(@)).d -o $@ -c $<"; \ + run_alias="CC"; \ + $(pretty_run) +endef + +define pretty_link_builtin + @run_cmd="$(LD) -r -nostartfiles $(LDFLAGS) -o $@ $^"; \ + run_alias="LD"; \ + $(pretty_run) +endef + +define pretty_link_shared_library + @run_cmd="$(CC) -shared -o $@ $^ $(LIBS)"; \ + run_alias="LD SHARED LIB"; \ + $(pretty_run) +endef + +define pretty_link_shared_binary + @run_cmd="$(CC) -o $@ $^ $(LIBS)"; \ + run_alias="LD SHARED BIN";\ + $(pretty_run) endef %.o: %.S - @$(pretty_build_c) + $(pretty_build_c) %.o: %.c - @$(pretty_build_c) + $(pretty_build_c) dep_files = $(wildcard .*.d) diff --git a/preload/Makefile b/preload/Makefile index 99dfcac..571d7a6 100644 --- a/preload/Makefile +++ b/preload/Makefile @@ -7,7 +7,6 @@ obj-default = libsb2.o libsb_env.o sb_alien.o extra_targets = libsb2.so -libsb2.so: built-in.o -# $(LD) --export-dynamic -Bsymbolic -shared -o libsb2.so built-in.o ../lua/built-in.o $(LIBS) - $(CC) -shared -o libsb2.so built-in.o ../lua/built-in.o $(LIBS) +libsb2.so: built-in.o ../lua/built-in.o + $(pretty_link_shared_library) diff --git a/utils/Makefile b/utils/Makefile index 05abf30..5aacab2 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -2,6 +2,5 @@ obj-default = sb2init.o extra_targets = sb2init sb2init: sb2init.o - $(CC) $(CFLAGS) -static -o sb2init sb2init.o - + $(pretty_link_shared_binary) -- cgit v1.2.3