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         nss-nspr \
  78         openssl1x \
  79         perl
  80 
  81 NAME =  illumos-extra
  82 
  83 AWK =           $(shell (which gawk 2>/dev/null | grep -v "^no ") || which awk)
  84 BRANCH =        $(shell git symbolic-ref HEAD | $(AWK) -F/ '{print $$3}')
  85 
  86 ifeq ($(TIMESTAMP),)
  87   TIMESTAMP =   $(shell date -u "+%Y%m%dT%H%M%SZ")
  88 endif
  89 
  90 GITDESCRIBE = \
  91         g$(shell git describe --all --long | $(AWK) -F'-g' '{print $$NF}')
  92 
  93 TARBALL =       $(NAME)-$(BRANCH)-$(TIMESTAMP)-$(GITDESCRIBE).tgz
  94 
  95 all: $(SUBDIRS)
  96 
  97 strap: $(STRAP_SUBDIRS)
  98 
  99 curl: libz openssl1x libidn
 100 gzip: libz
 101 node.js: openssl1x libm
 102 ncurses: libm
 103 dialog: ncurses
 104 socat: openssl1x
 105 wget: openssl1x libidn
 106 openldap: openssl1x
 107 libm: make
 108 g11n: make
 109 perl: libm
 110 
 111 #
 112 # pkg-config may be installed. This will actually only hurt us rather than help
 113 # us. pkg-config is based as a part of the pkgsrc packages and will pull in
 114 # versions of libraries that we have in /opt/local rather than using the ones in
 115 # /usr that we want. PKG_CONFIG_LIBDIR controls the actual path. This
 116 # environment variable nulls out the search path. Other vars just control what
 117 # gets appended.
 118 #
 119 
 120 $(DESTDIR)/usr/gnu/bin/gas: FRC
 121         (cd binutils && \
 122             PKG_CONFIG_LIBDIR="" \
 123             STRAP=$(STRAP) \
 124             $(MAKE) DESTDIR=$(DESTDIR) install)
 125 
 126 
 127 $(DESTDIR)/usr/bin/gcc: $(DESTDIR)/usr/gnu/bin/gas
 128         (cd gcc4 && \
 129             PKG_CONFIG_LIBDIR="" \
 130             STRAP=$(STRAP) \
 131             $(MAKE) DESTDIR=$(DESTDIR) install)
 132 
 133 $(SUBDIRS): $(DESTDIR)/usr/bin/gcc
 134         (cd $@ && \
 135             PKG_CONFIG_LIBDIR="" \
 136             STRAP=$(STRAP) \
 137             $(MAKE) DESTDIR=$(DESTDIR) install)
 138 
 139 install: $(SUBDIRS) gcc4 binutils
 140 
 141 install_strap: $(STRAP_SUBDIRS) gcc4 binutils
 142 
 143 clean: 
 144         -for dir in $(SUBDIRS) gcc4 binutils; \
 145             do (cd $$dir; $(MAKE) DESTDIR=$(DESTDIR) clean); done
 146         -rm -rf proto
 147 
 148 manifest:
 149         cp manifest $(DESTDIR)/$(DESTNAME)
 150 
 151 tarball:
 152         tar -zcf $(TARBALL) manifest proto
 153 
 154 FRC:
 155 
 156 .PHONY: manifest