: set -u ######################################################################## # Those parameters are used in test mode argone=${1-notset} argtwo=${2-notset} if [ $argone = "notset" ] ; then envone=${NETWENVONE-notset} if [ $envone != "notset" ] ; then argone=$envone fi fi if [ $argtwo = "notset" ] ; then envtwo=${NETWENVTWO-notset} if [ $envtwo != "notset" ] ; then argtwo=$envtwo fi fi ######################################################################## . ./compil/unix/version.sh echo "Netwox version ${NETWOXDEF_VERSION} (${NETWOXDEF_VERSIONMAJOR} ${NETWOXDEF_VERSIONMINOR} ${NETWOXDEF_VERSIONMICRO})" netwv="${NETWOXDEF_VERSIONMAJOR}${NETWOXDEF_VERSIONMINOR}" ######################################################################## echo "Loading config.dat" . ./config.dat ######################################################################## echo "Checking programs" # compute current location of netwib-config netwibconfig="${NETWIBDEF_INSTDBIN}/netwib${netwv}-config" # special test detection if [ $argone = "test" ] ; then netwibconfig=../../../test/netwox/compil/unix/netwib${netwv}-config fi progcheck () { progname=$1 progdesc="$2" type $progname 2> /dev/null 1> /dev/null if [ "$?Z" != "0Z" ] ; then echo "Error: the $progdesc '$progname' wasn't found" exit 1 else echo " $progname yes" fi } progcheck $netwibconfig "netwib configuration" progcheck $NETWOXDEF_PROGCC "compiler" progcheck $NETWOXDEF_PROGAR "archiver" progcheck $NETWOXDEF_PROGRANLIB "program" progcheck $NETWOXDEF_PROGFIND "find" progcheck $NETWOXDEF_PROGSED "sed" progcheck $NETWOXDEF_PROGTR "tr" progcheck $NETWOXDEF_PROGSORT "sort" ######################################################################## echo "Checking directories" dircheck () { dirname=$1 dirdesc="$2" if [ ! -d $dirname ] ; then echo "Warning: the $dirdesc directory '$dirname' wasn't found" else echo " $dirname yes" fi } dircheck $NETWOXDEF_INSTBIN "binary" dircheck $NETWOXDEF_INSTMAN "man" dircheck $NETWOXDEF_INSTMAN1 "man1" ######################################################################## echo "Compilation options selection" # options gccOpt=$NETWOXDEF_PROGCC_OPT # includes gccInc="${NETWOXDEF_PROGCC_INC} "`$netwibconfig -c` # libraries gccLib="${NETWOXDEF_PROGCC_LIB} "`$netwibconfig -l` # for users creating packages if [ "Z${NETWIBDEF_INSTDESTDIR}" != "Z" ] ; then gccInc="$gccInc -I${NETWIBDEF_INSTDINCLUDE}" gccLib="$gccLib -L${NETWIBDEF_INSTDLIB}" fi ######################################################################## echo "Generate the different files" ######### netwibhfile="netwib.h" echo " Creation of $netwibhfile" if [ $argone = "test" ] ; then echo "#include " > $netwibhfile else echo "#include " > $netwibhfile fi ######### deffile="def.h" echo " Creation of $deffile" echo "#define NETWOXDEF_VERSION \"$NETWOXDEF_VERSION\"" > $deffile echo "#define NETWOXDEF_VERSIONMAJOR $NETWOXDEF_VERSIONMAJOR" >> $deffile echo "#define NETWOXDEF_VERSIONMINOR $NETWOXDEF_VERSIONMINOR" >> $deffile echo "#define NETWOXDEF_VERSIONMICRO $NETWOXDEF_VERSIONMICRO" >> $deffile echo "#define NETWOXDEF_PROGCC \"$NETWOXDEF_PROGCC\"" >> $deffile echo "#define NETWOXDEF_PROGAR \"$NETWOXDEF_PROGAR\"" >> $deffile echo "#define NETWOXDEF_PROGRANLIB \"$NETWOXDEF_PROGRANLIB\"" >> $deffile echo "#define NETWOXDEF_PROGFIND \"$NETWOXDEF_PROGFIND\"" >> $deffile echo "#define NETWOXDEF_PROGSED \"$NETWOXDEF_PROGSED\"" >> $deffile echo "#define NETWOXDEF_PROGTR \"$NETWOXDEF_PROGTR\"" >> $deffile echo "#define NETWOXDEF_INSTBIN \"$NETWOXDEF_INSTBIN\"" >> $deffile echo "#define NETWOXDEF_INSTMAN \"$NETWOXDEF_INSTMAN\"" >> $deffile echo "#define NETWOXDEF_INSTMAN1 \"$NETWOXDEF_INSTMAN1\"" >> $deffile ######### echo " Creation of Makefiles" NETWOXDEF_PROGCCALIAS=`$netwibconfig -d PROGCCALIAS` NETWOXDEF_PROGCCWUNDEF=`$netwibconfig -d PROGCCWUNDEF` NETWOXDEF_PROGCCWSIGNC=`$netwibconfig -d PROGCCWSIGNC` if [ ${NETWOXDEF_PROGCCALIAS} = 1 ] ; then gccOpt="$gccOpt -fno-strict-aliasing" fi gccwundef="" if [ ${NETWOXDEF_PROGCCWUNDEF} = 1 ] ; then gccwundef="-Wundef" fi gccwsignc="" if [ ${NETWOXDEF_PROGCCWSIGNC} = 1 ] ; then gccwsignc="-Wsign-compare" fi netwox_file_list () { thedir=$1 $NETWOXDEF_PROGFIND $thedir -type f -name "*.c" |\ $NETWOXDEF_PROGSED 's|^'$thedir'/||' | $NETWOXDEF_PROGSED 's|\.c$||' |\ $NETWOXDEF_PROGSORT } netwox_head_make () { cat < $dm echo "all: ../modtool.a" >> $dm echo "../modtool.a: $allfiles" >> $dm echo " \$(AR) -cr ../modtool.a $allfiles" >> $dm netwox_file_list $thedir | while read f do if [ $dependh -eq 1 ] ; then if [ $f = "tool" ] ; then echo "$f.o: $f.c $f.h ../tools.list ../tools.h" >> $thedir/Makefile else echo "$f.o: $f.c $f.h" >> $thedir/Makefile fi else echo "$f.o: $f.c" >> $thedir/Makefile fi echo " \$(CC) \$(GCCOPT) \$(GCCINC) -c -o $f.o $f.c" >> $dm done } netwox_dir_make 0 tools netwox_dir_make 1 modules ## netwox_main_make () { netwox_head_make > Makefile echo " ." cat >> Makefile <> Makefile echo " @echo \"OK - You can now install netwox with 'make install'\"" >> Makefile fi cat >> Makefile <