improves automake
authorPeng Wu <alexepico@gmail.com>
Tue, 19 Feb 2013 07:44:36 +0000 (15:44 +0800)
committerPeng Wu <alexepico@gmail.com>
Tue, 19 Feb 2013 07:44:36 +0000 (15:44 +0800)
data/Makefile.am
utils/training/gen_unigram.cpp

index 8a3f356..7b35dcd 100644 (file)
 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 
-textual_model_data     = interpolation2.text \
-                               gb_char.table gbk_char.table \
+tablefiles             = gb_char.table gbk_char.table \
                                merged.table \
                                art.table culture.table economy.table \
                                geology.table history.table life.table \
                                nature.table scitech.table \
                                society.table sport.table
 
+binfiles               = ${tablefiles:.table=.bin}
+
+
+textual_model_data     = interpolation2.text \
+                               $(tablefiles)
+
 
-binary_model_data      = gb_char.bin gbk_char.bin \
-                               phrase_index.bin pinyin_index.bin \
+binary_model_data      = phrase_index.bin pinyin_index.bin \
                                bigram.db \
-                               merged.bin \
-                               art.bin culture.bin economy.bin \
-                               geology.bin history.bin life.bin \
-                               nature.bin scitech.bin \
-                               society.bin sport.bin
+                               $(binfiles)
 
 
 MAINTAINERCLEANFILES   = Makefile.in
@@ -50,7 +50,7 @@ interpolation2.text:
        tar xvf model2.text.tar.gz -C $(top_srcdir)/data
 
 
-gb_char.table gbk_char.table: interpolation2.text
+$(tablefiles): interpolation2.text
 
 bigram.db: $(textual_model_data)
        $(RM) $(binary_model_data)
@@ -58,7 +58,7 @@ bigram.db: $(textual_model_data)
        ../utils/storage/import_interpolation < $(top_srcdir)/data/interpolation2.text
        ../utils/training/gen_unigram
 
-gb_char.bin gbk_char.bin phrase_index.bin pinyin_index.bin: bigram.db
+phrase_index.bin pinyin_index.bin $(binfiles): bigram.db
 
 rebuild:
        git reset --hard
index c47c6ca..e1a91fd 100644 (file)
@@ -46,7 +46,7 @@ int main(int argc, char * argv[]){
         bool retval = chunk->load(binfile);
         if (!retval) {
             fprintf(stderr, "load %s failed!\n", binfile);
-            return false;
+            exit(ENOENT);
         }
 
         phrase_index.load(i, chunk);