Home | History | Annotate | Download | only in binutils
      1 #
      2 # CDDL HEADER START
      3 #
      4 # The contents of this file are subject to the terms of the
      5 # Common Development and Distribution License (the "License").
      6 # You may not use this file except in compliance with the License.
      7 #
      8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9 # or http://www.opensolaris.org/os/licensing.
     10 # See the License for the specific language governing permissions
     11 # and limitations under the License.
     12 #
     13 # When distributing Covered Code, include this CDDL HEADER in each
     14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15 # If applicable, add the following below this CDDL HEADER, with the
     16 # fields enclosed by brackets "[]" replaced with your own identifying
     17 # information: Portions Copyright [yyyy] [name of copyright owner]
     18 #
     19 # CDDL HEADER END
     20 #
     21 
     22 #
     23 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 
     27 #
     28 #ident	"@(#)Makefile.sfw	1.8	09/05/20 SMI"
     29 #
     30 
     31 include ../Makefile.cmd
     32 
     33 VER=$(COMPONENT_NAME:sh)-$(COMPONENT_VERSION:sh)
     34 TARBALL=$(VER).tar.bz2
     35 
     36 SFW_PATH="$(SPRO_VROOT)/bin:/usr/perl5/bin:/usr/sfw/bin:$(PATH)"
     37 
     38 all: $(VER)/config.status
     39 	(cd $(VER); env - \
     40 	    CC=$(CC) \
     41 	    "CFLAGS=$(CFLAGS) -xc99=none -xCC" \
     42 	    LD_OPTIONS="-M $(SRC)/cmd/mapfile_noexstk" \
     43 	    PATH=$(SFW_PATH) \
     44 	    MAKE=$(GMAKE) $(GMAKE))
     45 
     46 install: proto-fix
     47 
     48 install-target: all
     49 	(cd $(VER); env - \
     50 	CC=$(CC) \
     51 	"CFLAGS=$(CFLAGS) -xc99=none -xCC" \
     52 	LD_OPTIONS="-M $(SRC)/cmd/mapfile_noexstk" \
     53 	PATH=$(SFW_PATH) \
     54 	MAKE=$(GMAKE) \
     55 	$(GMAKE) install DESTDIR=$(ROOT))
     56 
     57 $(VER)/config.status: $(VER)/configure
     58 	(cd $(VER); env - \
     59 	    CC=$(CC) "CFLAGS=$(CFLAGS) -xc99=none -xCC" \
     60 	    LD_OPTIONS="-M $(SRC)/cmd/mapfile_noexstk" \
     61 	    PATH=$(SFW_PATH) \
     62 	    MAKE=$(GMAKE) \
     63 	    $(SH) ./configure \
     64 		--prefix=/usr/gnu \
     65 		--mandir=/usr/gnu/share/man \
     66 		--infodir=/usr/share/info \
     67 		--enable-64-bit-bfd )
     68 
     69 $(VER)/configure: $(TARBALL)
     70 	/usr/bin/bzip2 -dc $(TARBALL) | $(GTAR) xpf - --no-same-owner
     71 	(cd $(VER); patch -p0 < ../patch)
     72 	touch $(VER)/configure
     73 
     74 SOL_REV:sh=uname -r | sed "s,^5\.,2\.,"
     75 MACHINE=$(MACH)-$(MACH_TYPE)-solaris$(SOL_REV)
     76 LINKS=addr2line ar as c++filt gprof ld nm objcopy objdump ranlib readelf size strings strip
     77 DOC_SRC=$(VER)/binutils/doc
     78 MANPAGES=addr2line.1 ar.1 as.1 c++filt.1 gprof.1 ld.1 nlmconv.1 nm.1 objcopy.1 objdump.1 ranlib.1 readelf.1 size.1 strings.1 strip.1
     79 
     80 proto-fix: install-target
     81 	# remove unused pathnames
     82 	$(RM) $(ROOT)/usr/gnu/include/ansidecl.h
     83 	$(RM) $(ROOT)/usr/gnu/include/bfd.h
     84 	$(RM) $(ROOT)/usr/gnu/include/bfdlink.h
     85 	$(RM) $(ROOT)/usr/gnu/include/dis-asm.h
     86 	$(RM) $(ROOT)/usr/gnu/include/symcat.h
     87 	$(RM) $(ROOT)/usr/gnu/lib/libbfd.a
     88 	$(RM) $(ROOT)/usr/gnu/lib/libbfd.la
     89 	$(RM) $(ROOT)/usr/gnu/lib/libiberty.a
     90 	$(RM) $(ROOT)/usr/gnu/lib/libopcodes.a
     91 	$(RM) $(ROOT)/usr/gnu/lib/libopcodes.la
     92 	$(RM) $(ROOT)/usr/gnu/share/man/man1/dlltool.1
     93 	$(RM) $(ROOT)/usr/gnu/share/man/man1/windmc.1
     94 	$(RM) $(ROOT)/usr/gnu/share/man/man1/windres.1
     95 
     96 	if ! ggrep -q $(ROOT)/usr/gnu/include ../../Targetdirs; then \
     97 		rmdir $(ROOT)/usr/gnu/include; \
     98 	fi
     99 	if ! ggrep -q $(ROOT)/usr/gnu/lib ../../Targetdirs; then \
    100 		rmdir $(ROOT)/usr/gnu/lib; \
    101 	fi
    102 
    103 	# add links to /usr/bin and /usr/sfw/bin
    104 	for i in $(LINKS); do \
    105 		$(RM) $(ROOT)/usr/bin/g$$i; \
    106 		$(SYMLINK) ../gnu/bin/$$i $(ROOT)/usr/bin/g$$i; \
    107 		$(RM) $(ROOT)/usr/sfw/bin/g$$i; \
    108 		$(SYMLINK) ../../gnu/bin/$$i $(ROOT)/usr/sfw/bin/g$$i; \
    109 	done
    110 
    111 	# add sunman-stability, links to /usr/share/man
    112 	rm -rf sunman
    113 	mkdir sunman
    114 	for i in $(MANPAGES); do \
    115 		$(CP) $(ROOT)/usr/gnu/share/man/man1/$$i sunman; \
    116 		$(SED) -f sunman-stability sunman/$$i > $(ROOT)/usr/gnu/share/man/man1/$$i; \
    117 		$(RM) $(ROOT)/usr/share/man/man1/g$$i; \
    118 		$(SYMLINK) ../../../gnu/share/man/man1/$$i $(ROOT)/usr/share/man/man1/g$$i; \
    119 	done
    120 
    121 	# apply the file attributes from the packaging
    122 	for pkg in $(COMPONENT_PACKAGES:sh); do \
    123 		$(SRC)/tools/protofix --pkg $$pkg --perm; \
    124 	done
    125 
    126 clean:
    127 	-rm -rf $(VER) sunman
    128 
    129 include ../Makefile.targ
    130 
    131 FRC:
    132