Changeset 3 for trunk


Ignore:
Timestamp:
2006-05-13T03:53:31+02:00 (8 years ago)
Author:
moo
Message:

rewrite as bash script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/make.devel

    r1 r3  
    1 #!/usr/bin/make -if 
    2 # vim:syntax=make 
    3 SELF=MAKELEVEL=0 ./make.devel 
     1#!/bin/bash 
    42 
    5 # You should copy make.inc from make.inc.default 
    6 include make.inc 
     3if test -e make.inc ; then 
     4    . make.inc 
     5else 
     6    echo make.inc is required, see make.inc.example >&2 
     7    exit 
     8fi 
    79 
    8 all: opcode_spec_def const_string tags 
     10CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null ` 
     11AWK=`which gawk 2>/dev/null || which awk 2>/dev/null ` 
    912 
    10 clean: clean_const_string 
     13make_all() { 
     14    make_opcode_spec_def.h 
     15    make_const_string 
     16    make_tags 
     17} 
     18 
     19make_clean() { 
     20    make_clean_const_string 
     21    echo "*" rm -f tags opcode_spec_def.h 
    1122    rm -f tags opcode_spec_def.h 
     23} 
    1224 
    13 const_string: 
    14     @-$(SELF) const_string_opcodes_php4.x.h 
    15     @-$(SELF) const_string_opcodes_php5.0.h 
    16     @-$(SELF) const_string_opcodes_php5.1.h 
    17     @-$(SELF) const_string_opcodes_php6.x.h 
     25make_const_string() { 
     26    make_const_string_opcodes_php4.x.h 
     27    make_const_string_opcodes_php5.0.h 
     28    make_const_string_opcodes_php5.1.h 
     29    make_const_string_opcodes_php6.x.h 
     30} 
    1831 
    19 clean_const_string: 
    20     rm -f const_string_opcodes_php4.x.h const_string_opcodes_php5.0.h const_string_opcodes_php5.1.h const_string_opcodes_php6.x.h 
     32make_clean_const_string() { 
     33    echo "*" rm -f const_string_opcodes_php*.h 
     34    rm -f const_string_opcodes_php*.h 
     35} 
    2136 
    22 const_string_opcodes_php4.x.h: $(PHP4_x_DIR)/Zend/zend_compile.h 
    23     ./mkopcode.awk <       $(PHP4_x_DIR)/Zend/zend_compile.h > const_string_opcodes_php4.x.h 
     37make_const_string_opcodes_php4.x.h() { 
     38    precheck const_string_opcodes_php4.x.h "${PHP4_x_DIR}/Zend/zend_compile.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O" 
     39} 
    2440 
    25 const_string_opcodes_php5.0.h: $(PHP5_0_DIR)/Zend/zend_vm_def.h 
    26     ./mkopcode.awk <       $(PHP5_0_DIR)/Zend/zend_vm_def.h  > const_string_opcodes_php5.0.h 
     41make_const_string_opcodes_php5.0.h() { 
     42    precheck const_string_opcodes_php5.0.h "${PHP5_0_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./mkopcode.awk < "$I" > "$O" 
     43} 
    2744 
    28 const_string_opcodes_php5.1.h: $(PHP5_1_DIR)/Zend/zend_vm_def.h 
    29     ./mkopcode.awk <       $(PHP5_1_DIR)/Zend/zend_vm_def.h  > const_string_opcodes_php5.1.h 
     45make_const_string_opcodes_php5.1.h() { 
     46    precheck const_string_opcodes_php5.1.h "${PHP5_1_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./mkopcode.awk < "$I" > "$O" 
     47} 
    3048 
    31 const_string_opcodes_php6.x.h: $(PHP6_x_DIR)/Zend/zend_vm_def.h 
    32     ./mkopcode.awk <       $(PHP6_x_DIR)/Zend/zend_vm_def.h  > const_string_opcodes_php6.x.h 
     49make_const_string_opcodes_php6.x.h() { 
     50    precheck const_string_opcodes_php6.x.h "${PHP6_x_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./mkopcode.awk < "$I" > "$O" 
     51} 
    3352 
    34 tags: 
    35     test -d $(PHP_DEVEL_DIR) && ctags -R . $(PHP_DEVEL_DIR)/main $(PHP_DEVEL_DIR)/Zend $(PHP_DEVEL_DIR)/TSRM $(PHP_DEVEL_DIR)/ext/standard || ctags -R . 
     53make_opcode_spec_def.h() { 
     54    precheck "opcode_spec_def.h" "${EA_DIR}/opcodes.c" && "$AWK" -f ./mkopcode_spec.awk < "$I" > "$O" 
     55} 
    3656 
    37 opcode_spec_def: 
    38     @-$(SELF) opcode_spec_def.h 
     57make_tags() { 
     58    if test -z "$CTAGS" ; then 
     59        echo ctags not found, skip building tags >&2 
     60        return 
     61    fi 
    3962 
    40 opcode_spec_def.h: $(EA_DIR)/opcodes.c 
    41     ./mkopcode_spec.awk < $(EA_DIR)/opcodes.c > opcode_spec_def.h \ 
     63    if test -d "${PHP_DEVEL_DIR}" ; then 
     64        echo "* Making tags with ${PHP_DEVEL_DIR}" 
     65        "$CTAGS" -R . "${PHP_DEVEL_DIR}/main" "${PHP_DEVEL_DIR}/Zend" "${PHP_DEVEL_DIR}/TSRM" "${PHP_DEVEL_DIR}/ext/standard" 
     66    else 
     67        echo "* Making tags without php source files" 
     68        "$CTAGS" -R . 
     69    fi 
     70} 
    4271 
    43 .PHONY: const_string opcode_spec_def 
     72error() { 
     73    echo "$@" >&2 
     74} 
     75 
     76precheck() { 
     77    if ! test -e "$2" ; then 
     78        error X skipping "$1" because "$2" not found 
     79        return 1 
     80    fi 
     81    if ! test "$1" -ot "$2" ; then 
     82        echo O "$1" is up to date. 
     83        return 1 
     84    fi 
     85    O="$1" 
     86    I="$2" 
     87    echo "* Making $1 from $2" 
     88    return 0 
     89} 
     90 
     91if test -z "$1" ; then 
     92    make_all 
     93else 
     94    while ! test -z "$1" ; do 
     95        eval "make_$1" 
     96        shift 
     97    done 
     98fi 
     99 
Note: See TracChangeset for help on using the changeset viewer.