code duplication
[netris.git] / Makefile
index ba1890894ed93fc857987994a5709bbacb33a649..94fef74ba3b86d6d28ea21c198eb52055106e0ec 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,30 +8,42 @@ PROG = netris
 SPROG = netrisserver
 HEADERS = netris.h
 
-SRCS = game.c curses.c board.c util.c inet.c
+SRCS = client.c curses.c board.c util.c inet.c
 SSRCS = server.c util.c
 
 OBJS = $(SRCS:.c=.o)
 SOBJS = $(SSRCS:.c=.o)
 
 DISTFILES = README FAQ INSTALL COPYING TODO CHANGES \
-       Configure Makefile netris.h \
+       configure Makefile netris.h \
        $(SRCS) server.c \
 
-all: Makefile config.h $(PROG) $(SPROG)
+all: 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:
        $(CC) $(CFLAGS) -c $<
 
-Makefile config.h: Configure
+config.h: configure
        @echo "Makefile and/or config.h is out of date"
-       @echo "Run ./Configure now"
+       @echo "Run ./configure now"
        @false
 
 dist: $(DISTFILES)
@@ -42,12 +54,12 @@ dist: $(DISTFILES)
        cp $(DISTFILES) $$dir; \
        chmod 755 $$dir; \
        chmod 644 $$dir/*; \
-       chmod 755 $$dir/Configure; \
+       chmod 755 $$dir/configure; \
        echo "Creating $$dir.tar.gz"; \
        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