root/trunk/assemble

Revision 5, 2.3 kB (checked in by syllogism, 6 years ago)

Initial Commit

  • Property svn:executable set to *
Line 
1 #! /bin/bash
2
3 # assemble nasm files
4
5 # Copyright (c) 2006, Jonas Zaddach & Brad DeMorrow
6 # All rights reserved.
7 #
8 # Redistribution and use in source and binary forms,
9 # with or without modification, are permitted provided
10 # that the following conditions are met:
11 #
12 # * Redistributions of source code must retain the above copyright notice,
13 #   this list of conditions and the following disclaimer.
14 # * Redistributions in binary form must reproduce the above copyright notice,
15 #   this list of conditions and the following disclaimer in the documentation
16 #   and/or other materials provided with the distribution.
17 # * Neither the name of the <ORGANIZATION> nor the names of its contributors
18 #   may be used to endorse or promote products derived from this software
19 #   without specific prior written permission.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 # POSSIBILITY OF SUCH DAMAGE.
32
33 #split path variable into pieces
34 ALL_PATH=`echo $PATH | sed -e 's/:/\n/g'`
35
36 #try to find nasm
37 if [ "$CUSTOM_NASM" == "" ]
38 then
39   for MY_PATH in $ALL_PATH
40   do
41     CUSTOM_NASM=`find $MY_PATH -name nasm 2> /dev/null`
42     if [ "$CUSTOM_NASM" != "" ]
43     then
44       break
45     fi
46   done
47  
48   if [ "$CUSTOM_NASM" == "" ]
49   then
50     echo 'nasm not found in your $PATH variable.'
51     echo 'Please specify location of your nasm in $CUSTOM_NASM.'
52     exit
53   fi
54 fi
55
56 echo "using nasm:      $CUSTOM_NASM"
57
58 mkdir -p tmp/objs
59
60 # find all assembler files
61 AS_FILES=`find osian/kernel -name "*.asm" 2> /dev/null`
62
63 # and assemble them
64 for AS_FILE in $AS_FILES
65 do
66   OBJ_FILE=`echo $AS_FILE | sed -e 's/\.\///' | \
67     sed -e 's/\//_/g' | sed -e 's/\.asm/\.o/'`
68   $CUSTOM_NASM -f elf $AS_FILE -o tmp/objs/$OBJ_FILE
69 done
Note: See TracBrowser for help on using the browser.