|
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 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
|
22 # |
|
23 # |
|
24 # Rules and Macros for building opens source software that uses AT&T's package |
|
25 # tool. |
|
26 # |
|
27 # To use these rules, include ../make-rules/attpackagemake.mk in your Makefile |
|
28 # and define "build", "install" targets appropriate to building your component. |
|
29 # Ex: |
|
30 # |
|
31 # build: $(BUILD_32) \ |
|
32 # $(BUILD_64) |
|
33 # |
|
34 # install: $(INSTALL_32) \ |
|
35 # $(INSTALL_64) |
|
36 # |
|
37 # Any additional pre/post configure, build, or install actions can be specified |
|
38 # in your Makefile by setting them in on of the following macros: |
|
39 # COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION |
|
40 # COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION |
|
41 # |
|
42 # If component specific make targets need to be used for build or install, they |
|
43 # can be specified in |
|
44 # COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS |
|
45 # |
|
46 |
|
47 # Environment variables and arguments passed into the build and install |
|
48 # environment(s). These are the initial settings. |
|
49 COMPONENT_BUILD_ENV += \ |
|
50 CC="$(CC)" \ |
|
51 CCFLAGS="$(CFLAGS)" \ |
|
52 CCFLAGS.FORCE="$(CXXFLAGS)" \ |
|
53 CC.RUNPATH="$(CC.RUNPATH)" \ |
|
54 CC.LD.RUNPATH="$(CC.LD.RUNPATH)" \ |
|
55 CC.LD.ORIGIN="$(CC.LD.ORIGIN)" \ |
|
56 CC.DLL.ORIGIN="$(CC.DLL.ORIGIN)" \ |
|
57 CCLDFLAGS="$(CXXFLAGS)" \ |
|
58 LDOPTIONS="$(CXXFLAGS)" \ |
|
59 NPROCS="$(NPROCS)" \ |
|
60 LDFLAGS="$(CXXFLAGS)" |
|
61 |
|
62 # This is a workaround for the AT&T nmake failing to always use |
|
63 # the environmental CCFLAGS in sub-compiles |
|
64 COMPONENT_BUILD_ARGS= $(COMPONENT_BUILD_ENV) |
|
65 |
|
66 # build the configured source |
|
67 $(BUILD_DIR)/%/.built: $(SOURCE_DIR)/.prep |
|
68 $(RM) -r $(@D) ; $(MKDIR) $(@D) |
|
69 $(CLONEY) $(SOURCE_DIR) $(@D) |
|
70 $(COMPONENT_PRE_BUILD_ACTION) |
|
71 cd $(@D); $(ENV) $(COMPONENT_BUILD_ENV) \ |
|
72 bin/package make $(COMPONENT_BUILD_TARGETS) $(COMPONENT_BUILD_ARGS) |
|
73 $(COMPONENT_POST_BUILD_ACTION) |
|
74 $(TOUCH) $@ |
|
75 |
|
76 # install the built source into a prototype area |
|
77 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built |
|
78 $(COMPONENT_PRE_INSTALL_ACTION) |
|
79 $(RM) -r $(PROTO_DIR)/$(MACH$(BITS)); $(MKDIR) $(PROTO_DIR)/$(MACH$(BITS)); |
|
80 cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) \ |
|
81 bin/package flat $(COMPONENT_INSTALL_TARGETS) \ |
|
82 $(PROTO_DIR)/$(MACH$(BITS)) $(COMPONENT_INSTALL_PACKAGES) |
|
83 $(COMPONENT_POST_INSTALL_ACTION) |
|
84 $(TOUCH) $@ |
|
85 |
|
86 # test the built source |
|
87 $(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built |
|
88 $(COMPONENT_PRE_TEST_ACTION) |
|
89 cd $(@D) ; $(ENV) $(COMPONENT_TEST_ENV) bin/package \ |
|
90 test $(COMPONENT_TEST_TARGETS) |
|
91 $(COMPONENT_POST_TEST_ACTION) |
|
92 $(TOUCH) $@ |
|
93 |
|
94 clean:: |
|
95 $(RM) -r $(BUILD_DIR) $(PROTO_DIR) |