aboutsummaryrefslogtreecommitdiff
path: root/csu/Makefile
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-04-18 00:20:23 +0000
committerUlrich Drepper <drepper@redhat.com>1997-04-18 00:20:23 +0000
commit307bcd77838a5546a4fa65e7a88258a6ea78898c (patch)
treea0df3b4ed5d08f34b204955332c533c0114ee407 /csu/Makefile
parentdd33e89fb2693e88ba64e6b947184c5abf70ff00 (diff)
downloadglibc-307bcd77838a5546a4fa65e7a88258a6ea78898c.tar
glibc-307bcd77838a5546a4fa65e7a88258a6ea78898c.tar.gz
glibc-307bcd77838a5546a4fa65e7a88258a6ea78898c.tar.bz2
glibc-307bcd77838a5546a4fa65e7a88258a6ea78898c.zip
Rewrite by Zack Weinberg.cvs/libc-ud-970417
1997-04-18 02:18 Ulrich Drepper <drepper@cygnus.com> * csu/initfini.c: Rewrite by Zack Weinberg <zack@rabi.phys.columbia.edu>. * csu/Makefile: Add rules for rewrite. * csu/defs.awk: Helper script to generate derived header.
Diffstat (limited to 'csu/Makefile')
-rw-r--r--csu/Makefile44
1 files changed, 23 insertions, 21 deletions
diff --git a/csu/Makefile b/csu/Makefile
index 790a8feb8c..72ac51f84c 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -1,6 +1,6 @@
# Makefile for csu code for GNU C library.
-# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -56,7 +56,7 @@ have-initfini = yes
endif
-ifeq (yes,$(have-initfini))
+ifeq ($(have-initfini),yes)
CPPFLAGS += -DHAVE_INITFINI
@@ -67,27 +67,29 @@ crtstuff = crti crtn
install-lib += $(crtstuff:=.o)
extra-objs += $(crtstuff:=.o)
-generated += $(crtstuff:=.s)
+generated += $(crtstuff:=.S) initfini.s align.h end.h
omit-deps += $(crtstuff)
-# Compile initfini.c to assembly code, which contains embedded shell
-# commands that produce crti.s-new and crtn.s-new when run. We need to
-# disable emission of .size directives and debugging information, since
-# they will get confused by the splitting of the output we do.
-$(objpfx)cr%i.s $(objpfx)cr%n.s: initfini.c; $(initfini)
-
-define initfini
--rm -f $(objpfx)crtcommon.tmp
-(echo 'cat > crtcommon.tmp <<\EOF_common'; \
- $(CC) $< $(CPPFLAGS) $(CFLAGS) \
- -fPIC -finhibit-size-directive $(no-exceptions) -g0 -S -o -; \
- echo 'EOF_common') | (cd $(@D); $(SHELL))
-cat $(objpfx)crtcommon.tmp >> $(objpfx)crti.s-new
-cat $(objpfx)crtcommon.tmp >> $(objpfx)crtn.s-new
-rm -f $(objpfx)crtcommon.tmp
-mv -f $(objpfx)crti.s-new $(subst crtn,crti,$@)
-mv -f $(objpfx)crtn.s-new $(subst crti,crtn,$@)
-endef
+# Special rules for the building of crti.o and crtn.o
+$(objpfx)crt%.o: $(objpfx)crt%.S $(objpfx)defs.h
+ $(CC) -c -fPIC -g0 -I$(..) -I$(common-objpfx) -DASSEMBLER $< -o $@
+
+$(objpfx)initfini.s: initfini.c
+ $(CC) -S -fPIC -finhibit-size-directive $(no-exceptions) $< -o $@
+
+$(objpfx)crti.S: $(objpfx)initfini.s
+ sed -n -e '1,/@HEADER_ENDS/p' \
+ -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
+ -e '/@TRAILER_BEGINS/,$$p' $< > $@
+
+$(objpfx)crtn.S: $(objpfx)initfini.s
+ sed -n -e '1,/@HEADER_ENDS/p' \
+ -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
+ -e '/@TRAILER_BEGINS/,$$p' $< > $@
+
+$(objpfx)defs.h: $(objpfx)initfini.s
+ sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
+ awk -f defs.awk > $@
endif