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