OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [io/] [framebuf/] [current/] [src/] [gen_framebufs.tcl] - Blame information for rev 791

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#!/usr/bin/env tclsh
2
 
3
#===============================================================================
4
#
5
#    gen_framebufs.tcl
6
#
7
#    Amalgamate the various framebuffers available on a given platform
8
#
9
#===============================================================================
10
# ####ECOSGPLCOPYRIGHTBEGIN####                                             
11
# -------------------------------------------                               
12
# This file is part of eCos, the Embedded Configurable Operating System.    
13
# Copyright (C) 2008 Free Software Foundation, Inc.                         
14
#
15
# eCos is free software; you can redistribute it and/or modify it under     
16
# the terms of the GNU General Public License as published by the Free      
17
# Software Foundation; either version 2 or (at your option) any later       
18
# version.                                                                  
19
#
20
# eCos is distributed in the hope that it will be useful, but WITHOUT       
21
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     
22
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License     
23
# for more details.                                                         
24
#
25
# You should have received a copy of the GNU General Public License         
26
# along with eCos; if not, write to the Free Software Foundation, Inc.,     
27
# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             
28
#
29
# As a special exception, if other files instantiate templates or use       
30
# macros or inline functions from this file, or you compile this file       
31
# and link it with other works to produce a work based on this file,        
32
# this file does not by itself cause the resulting work to be covered by    
33
# the GNU General Public License. However the source code for this file     
34
# must still be made available in accordance with section (3) of the GNU    
35
# General Public License v2.                                                
36
#
37
# This exception does not invalidate any other reasons why a work based     
38
# on this file might be covered by the GNU General Public License.          
39
# -------------------------------------------                               
40
# ####ECOSGPLCOPYRIGHTEND####                                               
41
#===============================================================================
42
######DESCRIPTIONBEGIN####
43
#
44
# Author(s):    bartv
45
# Date:         2005-03-29
46
#
47
# This script is invoked via a custom make rule to generate a file
48
# <cyg/io/framebufs/framebufs.h>
49
#
50
#####DESCRIPTIONEND####
51
#===============================================================================
52
 
53
proc do_it { dir } {
54
 
55
    # dir should be set to <prefix>/install/include/cyg/io/framebufs
56
    if { ! [file exists $dir] } {
57
        file mkdir $dir
58
    }
59
    if { ! [file isdirectory $dir] } {
60
        puts stderr "gen_framebufs.tcl: strange build tree, $dir should be a directory"
61
        exit 1
62
    }
63
 
64
    set framebufs_file  [file join $dir "framebufs.h"]
65
    set current_data    ""
66
    if { [file exists $framebufs_file] } {
67
        set fd [open $framebufs_file "r"]
68
        set current_data [read $fd]
69
        close $fd
70
    }
71
 
72
    set headers [lsort [glob -nocomplain  [file join $dir "*.h*"]]]
73
 
74
    set new_data \
75
        "\#ifndef CYGONCE_IO_FRAMEBUFS_FRAMEBUFS_H
76
# define CYGONCE_IO_FRAMEBUFS_FRAMEBUFS_H
77
 
78
/* This is a generated file - do not edit!                      */
79
/* <cyg/io/framebufs/framebufs.h> should not be #include'd      */
80
/* directly, instead use <cyg/io/framebuf.h>                    */
81
"
82
 
83
    foreach header $headers {
84
        set header [file tail $header]
85
        if { [string equal "framebufs.h" $header] } {
86
            continue
87
        }
88
        append new_data "#include <cyg/io/framebufs/[set header]>\n"
89
    }
90
 
91
    # Next, work out the default test device. We need to read pkgconf/io_framebuf.h,
92
    # look for CYGDAT_IO_FRAMEBUF_DEVICES, and extract the first entry.
93
    set pkgconf_file [file join $dir "../../../pkgconf/io_framebuf.h"]
94
    if { ! [file exists $pkgconf_file] || ! [file readable $pkgconf_file] } {
95
        puts stderr "gen_framebufs.tcl: strange build tree, no access to $pkgconf_file"
96
        exit 1
97
    }
98
    set fd [open $pkgconf_file "r"]
99
    while { ! [eof $fd] } {
100
        set line [gets $fd]
101
        if { [regexp {^#define\s*CYGDAT_IO_FRAMEBUF_DEVICES\s*(\S*)\s+.*$} $line junk fb] } {
102
            append new_data "#define CYGDAT_IO_FRAMEBUF_DEFAULT_TEST_DEVICE $fb\n"
103
            break
104
        }
105
    }
106
 
107
    # Close the #ifndef CYGONCE_
108
    append new_data "#endif\n"
109
 
110
    if { ! [string equal $current_data $new_data] } {
111
        set fd [open $framebufs_file "w"]
112
        puts -nonewline $fd $new_data
113
        close $fd
114
    }
115
}
116
 
117
if { 0 == $::argc } {
118
    puts stderr "gen_framebufs.tcl: missing argument for install directory"
119
    exit 1
120
}
121
 
122
if { [catch { do_it [lindex $::argv 0] } msg] } {
123
    puts stderr "gen_framebufs.tcl: internal error"
124
    puts stderr "    $msg"
125
    exit 1
126
}
127
exit 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.