From 9369a6ab1a5dd4f09d76fc8a3c95be87c94b3067 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 9 Jul 2011 19:23:00 +0400 Subject: [PATCH] TARGET_SRC for not only C files but also C++ --- bash/smake/smake.sh | 12 ++++++++---- c/tex_parser/tex_parser.geany | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bash/smake/smake.sh b/bash/smake/smake.sh index 3fd7839..e953c05 100755 --- a/bash/smake/smake.sh +++ b/bash/smake/smake.sh @@ -55,7 +55,11 @@ cat $HELP_FILE > Makefile echo >> Makefile # ======= Test for target ======= -[ ! -f $REP_TARGET.c ] && echo "$REP_TARGET.c doesn't exist" && exit -1 +TARGET_SRC= +for ext in c cpp cxx cc; do + [ -f "$REP_TARGET.$ext" ] && TARGET_SRC=$REP_TARGET.$ext && break +done +[ "$TARGET_SRC" == "" ] && echo "source file for $REP_TARGET not found" && exit -1 # ======= Environment ======= sed "s~REP_CC~$REP_CC~ ; s~REP_CXX~$REP_CXX~ ; \ @@ -90,11 +94,11 @@ echo >> Makefile cat $RULES_FILE >> Makefile REP_INCLUDE=`echo $REP_INCLUDE | sed "s~-I~~g ; s~\\$(HOME)~${HOME}~g"` -flist[0]=$REP_TARGET.c -fpath[0]=$REP_TARGET.c +flist[0]=$TARGET_SRC +fpath[0]=$TARGET_SRC nfiles=1 nparsed=0 -fdeplist[0]=`remove_c_comments.pl $REP_TARGET.c | grep -P '^[\t ]*#include[\t ]*"' | sed 's~[^"]*"\([^"]*\)".*~\1~' | sort -u` +fdeplist[0]=`remove_c_comments.pl $TARGET_SRC | grep -P '^[\t ]*#include[\t ]*"' | sed 's~[^"]*"\([^"]*\)".*~\1~' | sort -u` files_not_found= while [ $nfiles != $nparsed ]; do for f in ${fdeplist[$nparsed]}; do diff --git a/c/tex_parser/tex_parser.geany b/c/tex_parser/tex_parser.geany index 4f78263..44f8138 100644 --- a/c/tex_parser/tex_parser.geany +++ b/c/tex_parser/tex_parser.geany @@ -16,12 +16,12 @@ long_line_behaviour=1 long_line_column=72 [files] -current_page=2 +current_page=4 FILE_NAME_0=21;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_test.c;0 FILE_NAME_1=298;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.c;0 -FILE_NAME_2=0;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.h;0 +FILE_NAME_2=321;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.h;0 FILE_NAME_3=133;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_tags.h;0 -FILE_NAME_4=1831;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0 +FILE_NAME_4=1884;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0 [build-menu] NF_00_LB=_Сделать