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 24 BASE = $(PWD) 25 DESTDIR = $(BASE)/../proto 26 NATIVEDIR = $(BASE)/../proto.strap 27 ILLUMOS_SRC = $(BASE)/../projects/illumos/usr/src 28 29 ifeq ($(shell uname -s),Darwin) 30 MAKE = make 31 PATH = $(DESTDIR)/usr/bin:/bin:/usr/bin:/usr/sbin:/sbin:/opt/local/bin 32 else 33 MAKE = gmake 34 PATH = $(NATIVEDIR)/usr/bin:/usr/bin:/usr/sbin:/sbin:/opt/local/bin 35 endif 36 37 PARALLEL = -j128 38 GCC = $(NATIVEDIR)/usr/bin/gcc 39 GXX = $(NATIVEDIR)/usr/bin/g++ 40 41 CTFBINDIR = $(ILLUMOS_SRC)/tools/proto/root_i386-nd/opt/onbld/bin/i386 42 CTFMERGE = $(CTFBINDIR)/ctfmerge 43 CTFCONVERT = $(CTFBINDIR)/ctfconvert 44 45 SYSINCDIRS = /usr/include 46 SYSLIBDIRS = /usr/lib /lib 47 48 CPPFLAGS = $(SYSINCDIRS:%=-isystem $(DESTDIR)/%) 49 LDFLAGS = $(SYSLIBDIRS:%=-L$(DESTDIR)/%) -Wl,-zassert-deflib \ 50 -Wl,-zfatal-warnings 51 52 PREFIX_NODE = $(DESTDIR)/usr/node/0.8 53 NODE_EXEC = $(NATIVEDIR)/usr/node/0.8/bin/node 54 55 DEBUG_FLAGS = -g 56 WARN_FLAGS = -Wall -Wextra -Werror 57 PIC_FLAGS = -fPIC 58 OPT_FLAGS = -O2 59 60 NODE_CFLAGS = $(DEBUG_FLAGS) $(WARN_FLAGS) $(PIC_FLAGS) $(OPT_FLAGS) 61 62 STD_DEFS = -D_GNU_SOURCE 63 NODE_DEFS = -DBUILDING_NODE_EXTENSION 64 LF64_DEFS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 65 PIC_DEFS = -DPIC 66 NODE_INCS = -isystem $(PREFIX_NODE)/include/node -I. 67 68 NODE_CPPFLAGS = $(STD_DEFS) $(NODE_DEFS) $(LF64_DEFS) $(PIC_DEFS) $(NODE_INCS) 69 70 SHARED_FLAGS = -shared 71 ZTEXT = -Wl,-ztext 72 NODE_LIBDIR = -L$(PREFIX_NODE)/lib 73 74 NODE_LDFLAGS = $(SHARED_FLAGS) $(ZTEXT) $(NODE_LIBDIR) 75 76 SUBDIR_CC = CC="$(GCC)" 77 SUBDIR_CXX = CXX="$(GXX)" 78 SUBDIR_CPPFLAGS = CPPFLAGS="$(CPPFLAGS)" 79 SUBDIR_CFLAGS = CFLAGS="$(CFLAGS)" 80 SUBDIR_CXXFLAGS = CXXFLAGS="$(CXXFLAGS)" 81 SUBDIR_LDFLAGS = LDFLAGS="$(LDFLAGS)" 82 SUBDIR_LIBS = LIBS="$(LIBS)" 83 SUBDIR_MAKE = MAKE="$(MAKE)" 84 SUBDIR_DESTDIR = DESTDIR="$(DESTDIR)" 85 86 SUBDIR_ENV = \ 87 $(SUBDIR_CC) \ 88 $(SUBDIR_CXX) \ 89 $(SUBDIR_CPPFLAGS) \ 90 $(SUBDIR_CFLAGS) \ 91 $(SUBDIR_CXXFLAGS) \ 92 $(SUBDIR_LDFLAGS) \ 93 $(SUBDIR_LIBS) \ 94 $(SUBDIR_MAKE) \ 95 $(SUBDIR_DESTDIR)