📄 makegen
字号:
#!/bin/sh## makegen generates Makefiles from simple template files.# Any line in a Makefile.tmpl file that starts with "!" causes# a shell script to be executed with it's output redirected into# the Makefile. This is very simple but allows me to do things# like include Site.mm global definitions and protability stuff# without needing the new bsd make etc.## bambi#trap "rm -f Makefile.full; echo; echo ABORT!; echo; exit 1" 1 2 3 10 15 # Is this a Posix or bsd-ish shell?if echo '\c' | grep -s c >/dev/null 2>&1then ECHO_N="-n" ECHO_C=""else ECHO_N="" ECHO_C='\c'fi# Load the makegen config infoTOP=$1INST_DIR=$2export TOPexport INST_DIRif test "$INST_DIR." = "."then MACRO_DIR=$TOPelse MACRO_DIR=$INST_DIRfiexport MACRO_DIROS_NAME=`uname -s | sed "s,/,_,"`OS_RELEASE=`uname -r`OS_ARCH=`uname -m`if test $OS_NAME = "OS_2"then OS_TYPE="_OS_OS2"fiif test $OS_NAME = "WIN32"then OS_TYPE="_OS_WIN32"fiif test "$OS_TYPE." = "."then OS_TYPE="_OS_UNIX"fiexport OS_NAMEexport OS_RELEASEexport OS_ARCHexport OS_TYPEif test -f $TOP/makegen/makegen.cfthen . $TOP/makegen/makegen.cfelse if test -f $INST_DIR/makegen/makegen.cf then . $INST_DIR/makegen/makegen.cf else echo "Error ! Can't find makegen.cf !!" exit 1 fifiechoecho Regenerating Makefile.cat > Makefile.full << !EOF!## This is a "makegen" generated Makefile based on Makefile.tmpl## Makegen has been developed as part of Minerva by David J. Hughes## ******************** DO NOT EDIT THIS BY HAND ********************#SHELL=/bin/sh## Project top directory and current directory (SOURCE_DIR can be redefined)#TOP=$TOPSOURCE_DIR=.## OS Information#OS_NAME=$OS_NAMEOS_RELEASE=$OS_RELEASEOS_ARCH=$OS_ARCHOS_TYPE=$OS_TYPE!EOF!cat $TOP/Site.mm >> Makefile.fullecho "CC_FLAGS= \$(CFLAGS)LD_LIBS= \$(LDLIBS)## Default Makefile Rules#install :: allclean :: rm -f Makefile.full## Makefile Rules#" >> Makefile.fullT=" "NL_IFS=""TS_IFS=" "IFS="${NL_IFS}"{while read linedo echo $ECHO_N ".$ECHO_C" # # bash stuffs up reads sometimes by dropping a ^A around \\ escapes # It's a hack, but stripping them out like this works. # line=`echo $line | sed "s///g"` if echo $line | grep "^[ $T]*!"> /dev/null then command=`echo $line | \ sed "s,^[ $T]*!\([a-zA-Z0-9_]*\).*,${MACRO_DIR}\/makegen\/\1.mm,"` args=`echo $line | \ sed "s,^[ $T]*!\([a-zA-Z0-9_]*\)\(.*\),\2,"` IFS="$TS_IFS" if test ! -f $command then echo echo "Unknown makegen command \"$command\"" echo rm -f Makefile.full exit 2 fi $command $args >> Makefile.full IFS="$NL_IFS" else # The sed hack below is for 4.4BSD's shell that doesn't # replace \\ with \ during a read. echo "$line" | sed "s/\\\\\\\\/\\\\/g s/\\\\\\\\/\\\\/g" >> Makefile.full fidone} < Makefile.tmplecho >> Makefile.fullecho >> Makefile.fullechoecho "Done."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -