source: svn/trunk/newcon3bcm2_21bu/nexus/build/os/ucos_ii/module_rules.pl

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 7.4 KB
Line 
1#############################################################################
2#    (c)2008-2011 Broadcom Corporation
3#
4# This program is the proprietary software of Broadcom Corporation and/or its licensors,
5# and may only be used, duplicated, modified or distributed pursuant to the terms and
6# conditions of a separate, written license agreement executed between you and Broadcom
7# (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8# no license (express or implied), right to use, or waiver of any kind with respect to the
9# Software, and Broadcom expressly reserves all rights in and to the Software and all
10# intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11# HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12# NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13#
14# Except as expressly set forth in the Authorized License,
15#
16# 1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17# secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18# and to use this information only in connection with your use of Broadcom integrated circuit products.
19#
20# 2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21# AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22# WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23# THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24# OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25# LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26# OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27# USE OR PERFORMANCE OF THE SOFTWARE.
28#
29# 3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30# LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31# EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32# USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33# THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34# ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35# LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36# ANY LIMITED REMEDY.
37#
38# $brcm_Workfile: module_rules.pl $
39# $brcm_Revision: 4 $
40# $brcm_Date: 10/18/11 9:38a $
41#
42# Module Description:
43#
44# Revision History:
45#
46# $brcm_Log: /nexus/build/os/ucos/module_rules.pl $
47#
48# 4   10/18/11 9:38a erickson
49# SW7358-162: generate nexus_class_verification.h. sync up file with
50#  linuxuser/module_rules.pl.
51#
52# 3   9/15/10 3:43p jtna
53# SW7420-1004: add synthunk for CORE and PLATFORM
54#
55# 2   6/27/08 8:59a erickson
56# PR43846: convert to $(PERL)
57#
58# 1   6/17/08 3:03p cnovak
59# PR43697: Add uCOS to Nexus.
60#
61#############################################################################
62use strict;
63
64my $i;
65my $moduleUpper;
66
67my $file = shift @ARGV;
68open(OUTFILE, ">$file") or die "Unable to open output file $file";
69
70print OUTFILE "#####################################################\n";
71print OUTFILE "# This file is automatically generated.  Do not edit.\n";
72print OUTFILE "#####################################################\n";
73
74print OUTFILE "\$(NEXUS_SYNCTHUNK_DIR)/exists:\n";
75print OUTFILE "\t\$(Q_)\$(MKDIR) \$@\n";
76print OUTFILE "\n";
77print OUTFILE "CLASS_LIST=\$(NEXUS_SYNCTHUNK_DIR)/class_list.inc\n";
78print OUTFILE "CLASS_VERIFICATION=\$(NEXUS_SYNCTHUNK_DIR)/nexus_class_verification.h\n";
79print OUTFILE "PUBLIC_INCLUDES := ";
80foreach $moduleUpper (@ARGV) {
81    next if ($moduleUpper eq 'BASE');
82    print OUTFILE "\$(addsuffix /*.h,\$(NEXUS_$moduleUpper\_PUBLIC_INCLUDES)) ";
83}
84print OUTFILE "\n";
85
86# Generate nexus_class_verification.h using PERL
87print OUTFILE "NEXUS_SERVER_MODULES=\$(filter-out \$(NEXUS_CLIENT_MODULES),\$(NEXUS_MODULES))\n";
88print OUTFILE "\$(CLASS_LIST) \$(CLASS_VERIFICATION): \n";
89print OUTFILE "\t\$(Q_)cd \$(NEXUS_TOP)/build/tools/kernelproxy && \$(PERL) class_list.pl \$(CLASS_LIST) \$(CLASS_VERIFICATION) -headers \$(PUBLIC_INCLUDES) -modules \$(NEXUS_SERVER_MODULES)\n";
90print OUTFILE "\n";
91
92foreach $moduleUpper (@ARGV) {
93    my $moduleLower = lc $moduleUpper;
94    my $thunked = 1;
95    my $proxy = 0;
96
97        print OUTFILE "#\n# $moduleUpper\n#\n";
98        print OUTFILE "\$(NEXUS_OBJ_DIR)/$moduleUpper/exists:\n";
99        print OUTFILE "\t\$(Q_)\$(MKDIR) \$@\n";
100        print OUTFILE "\n";
101
102        # Skip thunks for BASE -- it is an exception
103        if ( ($moduleUpper eq 'BASE') ) {
104           $thunked = 0;
105           $proxy = 0;
106        }
107
108        if( $proxy == 1) {
109           print OUTFILE "NEXUS_$moduleUpper\_DRIVER := \$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_driver.c \$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_ioctl.h\n";
110           print OUTFILE "NEXUS_$moduleUpper\_PROXY := \$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_proxy.c \$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_ioctl.h\n";
111           print OUTFILE "NEXUS_$moduleUpper\_OBJECTS += \$(NEXUS_OBJ_DIR)/$moduleUpper/nexus_$moduleLower\_driver.\$(NEXUS_OBJ_SUFFIX)\n";
112           print OUTFILE "\n";
113           print OUTFILE "\$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_driver.c: \$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_ioctl.h\n";
114           print OUTFILE "\n";
115           print OUTFILE "\$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_ioctl.h: \$(wildcard \$(addsuffix /*.h,\$(NEXUS_$moduleUpper\_PUBLIC_INCLUDES)))\n";
116           print OUTFILE "\t\$(Q_)\$(MKDIR) \$(NEXUS_SYNCTHUNK_DIR) >& /dev/null\n";
117           print OUTFILE "\t\@echo \"[Proxy..... $moduleLower]\"\n";
118           print OUTFILE "\t\$(Q_)cd \$(NEXUS_TOP)/build/tools/kernelproxy && \$(PERL) bapi_build.pl $moduleUpper \$(NEXUS_SYNCTHUNK_DIR) \$(addsuffix /*.h,\$(NEXUS_$moduleUpper\_PUBLIC_INCLUDES))\n";
119           print OUTFILE "\n";
120        }
121
122        # syncthunk
123        if ( $thunked == 1 ) {
124           # Thunk Info
125           print OUTFILE "NEXUS_$moduleUpper\_SYNCTHUNKS := \$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_thunks.c \$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_thunks.h\n";
126           print OUTFILE "\n";
127           print OUTFILE "\$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_thunks.c: \$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_thunks.h\n";
128           print OUTFILE "\n";
129                        # if there's no proxy, we still need nexus_class_verification.h for the stubs
130           print OUTFILE "\$(NEXUS_SYNCTHUNK_DIR)/nexus_$moduleLower\_thunks.h: \$(wildcard \$(addsuffix /*.h,\$(NEXUS_$moduleUpper\_PUBLIC_INCLUDES))) \$(CLASS_LIST) \$(NEXUS_SYNCTHUNK_DIR)/exists \$(CLASS_VERIFICATION)\n";
131           print OUTFILE "\t\@echo \"[Thunk..... $moduleLower]\"\n";
132           print OUTFILE "\t\$(Q_)cd \$(NEXUS_TOP)/build/tools/syncthunk && \$(PERL) bapi_build.pl $moduleUpper \$(NEXUS_SYNCTHUNK_DIR) \$(addsuffix /*.h,\$(NEXUS_$moduleUpper\_PUBLIC_INCLUDES))\n";
133           print OUTFILE "\n";
134        }
135
136        # Module Rules
137        print OUTFILE "\$(NEXUS_$moduleUpper\_OBJECTS): \$(NEXUS_OBJ_DIR)/$moduleUpper/%.\$(NEXUS_OBJ_SUFFIX): %.c \$(NEXUS_$moduleUpper\_SYNCTHUNKS) \$(NEXUS_$moduleUpper\_DRIVER)  \n";
138        print OUTFILE "\t\$(Q_)\$(MKDIR) \$(NEXUS_OBJ_DIR)/$moduleUpper >& /dev/null\n";
139        print OUTFILE "\t\@echo \"[Compile... \$(notdir \$<) ($moduleLower)]\"\n";
140        print OUTFILE "\t\$(Q_)\$(CC) \$(CDEP_FLAG) \$(NEXUS_CFLAGS) \$(NEXUS_$moduleUpper\_CFLAGS) -c \$< -o \$@\n";
141        print OUTFILE "\n";
142
143}
144close OUTFILE;
145
Note: See TracBrowser for help on using the repository browser.