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, Version 1.0 only
   6 # (the "License").  You may not use this file except in compliance
   7 # with the License.
   8 #
   9 # You can obtain a copy of the license at COPYING
  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 COPYING.
  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 # Copyright (c) 2012, Joyent, Inc.
  22 #
  23 # To build everything just run 'gmake' in this directory.
  24 #
  25 
  26 BASE =          $(PWD)
  27 DESTDIR =       $(BASE)/proto
  28 PATH =          $(DESTDIR)/usr/bin:/usr/bin:/usr/sbin:/sbin:/opt/local/bin
  29 SUBDIRS = \
  30         bash \
  31         bind \
  32         bzip2 \
  33         coreutils \
  34         cpp \
  35         curl \
  36         dialog \
  37         g11n \
  38         gnupg \
  39         gtar \
  40         gzip \
  41         ipmitool \
  42         less \
  43         libexpat \
  44         libidn \
  45         libm \
  46         libxml \
  47         libz \
  48         make \
  49         ncurses \
  50         node.js \
  51         nss-nspr \
  52         ntp \
  53         openldap \
  54         openlldp \
  55         openssl \
  56         openssl1x \
  57         pbzip2 \
  58         perl \
  59         rsync \
  60         rsyslog \
  61         screen \
  62         socat \
  63         tun \
  64         uuid \
  65         vim \
  66         wget
  67 
  68 STRAP_SUBDIRS = \
  69         cpp \
  70         bzip2 \
  71         libexpat \
  72         libidn \
  73         libm \
  74         libxml \
  75         libz \
  76         make \
  77         node.js \
  78         nss-nspr \
  79         openssl1x \
  80         perl
  81 
  82 NAME =  illumos-extra
  83 
  84 AWK =           $(shell (which gawk 2>/dev/null | grep -v "^no ") || which awk)
  85 BRANCH =        $(shell git symbolic-ref HEAD | $(AWK) -F/ '{print $$3}')
  86 
  87 ifeq ($(TIMESTAMP),)
  88   TIMESTAMP =   $(shell date -u "+%Y%m%dT%H%M%SZ")
  89 endif
  90 
  91 GITDESCRIBE = \
  92         g$(shell git describe --all --long | $(AWK) -F'-g' '{print $$NF}')
  93 
  94 TARBALL =       $(NAME)-$(BRANCH)-$(TIMESTAMP)-$(GITDESCRIBE).tgz
  95 
  96 all: $(SUBDIRS)
  97 
  98 strap: $(STRAP_SUBDIRS)
  99 
 100 curl: libz openssl1x libidn
 101 gzip: libz
 102 node.js: openssl1x libm
 103 ncurses: libm
 104 dialog: ncurses
 105 socat: openssl1x
 106 wget: openssl1x libidn
 107 openldap: openssl1x
 108 libm: make
 109 g11n: make
 110 perl: libm
 111 
 112 #
 113 # pkg-config may be installed. This will actually only hurt us rather than help
 114 # us. pkg-config is based as a part of the pkgsrc packages and will pull in
 115 # versions of libraries that we have in /opt/local rather than using the ones in
 116 # /usr that we want. PKG_CONFIG_LIBDIR controls the actual path. This
 117 # environment variable nulls out the search path. Other vars just control what
 118 # gets appended.
 119 #
 120 
 121 $(DESTDIR)/usr/gnu/bin/gas: FRC
 122         (cd binutils && \
 123             PKG_CONFIG_LIBDIR="" \
 124             STRAP=$(STRAP) \
 125             $(MAKE) DESTDIR=$(DESTDIR) install)
 126 
 127 
 128 $(DESTDIR)/usr/bin/gcc: $(DESTDIR)/usr/gnu/bin/gas
 129         (cd gcc4 && \
 130             PKG_CONFIG_LIBDIR="" \
 131             STRAP=$(STRAP) \
 132             $(MAKE) DESTDIR=$(DESTDIR) install strapfix)
 133 
 134 $(SUBDIRS): $(DESTDIR)/usr/bin/gcc
 135         (cd $@ && \
 136             PKG_CONFIG_LIBDIR="" \
 137             STRAP=$(STRAP) \
 138             $(MAKE) DESTDIR=$(DESTDIR) install)
 139 
 140 install: $(SUBDIRS) gcc4 binutils
 141 
 142 install_strap: $(STRAP_SUBDIRS) gcc4 binutils
 143 
 144 clean: 
 145         -for dir in $(SUBDIRS) gcc4 binutils; \
 146             do (cd $$dir; $(MAKE) DESTDIR=$(DESTDIR) clean); done
 147         -rm -rf proto
 148 
 149 manifest:
 150         cp manifest $(DESTDIR)/$(DESTNAME)
 151 
 152 tarball:
 153         tar -zcf $(TARBALL) manifest proto
 154 
 155 FRC:
 156 
 157 .PHONY: manifest