create msg.h from preferred language include
[netris.git] / Makefile
index 0baead23e60beef2b58d5a8cd1ed4d5238a24a20..389503bef1781e37d62ee64cea47ab39a1d44bf9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,10 +20,22 @@ DISTFILES = README FAQ INSTALL COPYING TODO CHANGES \
 
 all: Makefile config.h $(PROG) $(SPROG)
 
-$(PROG): $(OBJS)
+msg.h: msg.en.h $(MSG_FILE)
+       @echo "Linking $(MSG_FILE) to msg.h"
+       @echo '// WARNING! This is a generated file. Do NOT edit.' > msg.h
+       @echo '// See msg.*.h for the editable files.' >> msg.h
+       @echo '#include "$(MSG_FILE)"' >> msg.h
+
+ifneq ($(MSG_FILE),msg.en.h)
+       @echo "Adding untranslated messages to msg.h"
+       @echo '// untranslated messages from the English master file:' >> msg.h
+       @./msg_diff.sh $(MSG_FILE) < msg.en.h >> msg.h
+endif
+
+$(PROG): msg.h $(OBJS)
        $(CC) -o $(PROG) $(OBJS) $(LFLAGS) $(CFLAGS)
 
-$(SPROG): $(SOBJS)
+$(SPROG): msg.h $(SOBJS)
        $(CC) -o $(SPROG) $(SOBJS) $(LFLAGS) $(CFLAGS)
 
 .c.o:
@@ -47,7 +59,7 @@ dist: $(DISTFILES)
        tar -cvzof $$dir.tar.gz $$dir
 
 clean:
-       rm -f $(PROG) $(OBJS) $(SPROG) $(SOBJS) a.out
+       rm -f $(PROG) $(OBJS) $(SPROG) $(SOBJS) msg.h a.out
 
 cleandir: clean
        rm -f config.mak config.h