[klibc] [patch] kbuild: build all targets in gzip
Sam Ravnborg
sam at ravnborg.org
Sun Jul 31 04:52:50 PDT 2005
The gzip program had a few aliases - using ln to reach them.
Build these.
Also introduce gzip.stripped since it was present in the original
Makefile.
To support this a few new rules was added to scripts/Kbuild.klibc
Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
---
commit e7daa9d72c3c7ea2cf23ff34bf601989ced7c6e1
tree 15adb0ed586e264a41fc4b419a71d903faa1a9ca
parent 6b1838e0265930a078ab79815dfa8fe86102a562
author Sam Ravnborg <sam at mars.(none)> Sun, 31 Jul 2005 13:51:43 +0200
committer Sam Ravnborg <sam at mars.(none)> Sun, 31 Jul 2005 13:51:43 +0200
gzip/Kbuild | 61 ++++++++++++++++----------------------------------
scripts/Kbuild.klibc | 10 ++++++++
2 files changed, 30 insertions(+), 41 deletions(-)
diff --git a/gzip/Kbuild b/gzip/Kbuild
--- a/gzip/Kbuild
+++ b/gzip/Kbuild
@@ -1,49 +1,28 @@
+#
+# Kbuild file for gzip
+#
+# The gzip executable
user-progs := gzip
-gzip-y := gzip.o util.o unzip.o inflate.o
+gzip-y := gzip.o util.o unzip.o inflate.o
-ifeq (a,b)
+# Additional targets
+always := gunzip zcat gzip.stripped
-Kept for convinience
-ZIPSRCS = zip.c deflate.c trees.c bits.c
-UNZIPSRCS = unzip.c inflate.c
+# Optional ZIP support
+gzip-$(CONFIG_KLIB_ZIP) += zip.o deflate.o trees.o bits.o
+cflags-$(CONFIG_KLIB_ZIP) += -DSUPPORT_ZIP
+EXTRA_USERCFLAGS := $(cflags-y)
-SRCS = gzip.c util.c $(UNZIPSRCS)
-OBJS = $(SRCS:.c=.o)
-HDRS = gzip.h tailor.h revision.h
-LIBS = $(KLIBC) $(LIBGCC)
+# Additionally linked targets
+$(obj)/gunzip $(obj)/zcat: $(obj)/gzip
+ $(call cmd,ln)
-ifeq ($(ZIP),y)
-DEFS += -DSUPPORT_ZIP
-SRCS += $(ZIPSRCS)
-endif
+# A stripped version of gzip
+$(obj)/gzip.stripped: $(obj)/gzip
+ $(call cmd,strip)
-all: gzip gunzip zcat gzip.stripped
-# Actual build-related targets
-
-gzip: Makefile $(OBJS) $(CRT0) $(LIBS)
- $(LD) $(LDFLAGS) -o $@ $(CRT0) $(OBJS) $(LIBS)
-
-gunzip: gzip
- rm -f $@
- ln $< $@
-
-zcat: gzip
- rm -f $@
- ln $< $@
-
-gzip.stripped: gzip
- $(STRIP) $< -o $@
-
-clean:
- $(RM) -f core *.o gzip gunzip zcat gzip.stripped .*.d
-
-spotless: clean
- rm -f *~
-
-# These should presumably be shared...
-install: all
- $(INSTALL_EXEC) gzip gunzip zcat $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin
-
-endif
+# Old install target - TODO
+#install: all
+# $(INSTALL_EXEC) gzip gunzip zcat $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin
diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -263,6 +263,16 @@ quiet_cmd_userld = USERLD $@
$(filter-out FORCE,$^) -o $@
+# Link target to a new name
+# ---------------------------------------------------------------------------
+quiet_cmd_ln = LN $@
+ cmd_ln = rm -f $@ && ln $< $@
+
+# Strip target (remove all debugging info)
+quiet_cmd_strip = STRIP $@
+ cmd_strip = $(USERSTRIP) $(USERSTRIPFLAGS) $< -o $@
+
+
# Read all saved command lines and dependencies for the $(targets) we
# may be building above, using $(if_changed{,_dep}). As an
# optimization, we don't need to read them if the target does not
More information about the klibc
mailing list