modernize configure
[netris.git] / Makefile
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..ba18908
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,54 @@
+# Netris Makefile
+
+include config.mak
+
+VERSION = ?
+
+PROG = netris
+SPROG = netrisserver
+HEADERS = netris.h
+
+SRCS = game.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 \
+       $(SRCS) server.c \
+
+all: Makefile config.h $(PROG) $(SPROG)
+
+$(PROG): $(OBJS)
+       $(CC) -o $(PROG) $(OBJS) $(LFLAGS) $(CFLAGS)
+
+$(SPROG): $(SOBJS)
+       $(CC) -o $(SPROG) $(SOBJS) $(LFLAGS) $(CFLAGS)
+
+.c.o:
+       $(CC) $(CFLAGS) -c $<
+
+Makefile config.h: Configure
+       @echo "Makefile and/or config.h is out of date"
+       @echo "Run ./Configure now"
+       @false
+
+dist: $(DISTFILES)
+       @dir="netris-$(VERSION)"; \
+       echo "Creating $$dir directory"; \
+       rm -rf $$dir; \
+       mkdir $$dir; \
+       cp $(DISTFILES) $$dir; \
+       chmod 755 $$dir; \
+       chmod 644 $$dir/*; \
+       chmod 755 $$dir/Configure; \
+       echo "Creating $$dir.tar.gz"; \
+       tar -cvzof $$dir.tar.gz $$dir
+
+clean:
+       rm -f $(PROG) $(OBJS) $(SPROG) $(SOBJS) a.out
+
+cleandir: clean
+       rm -f config.mak config.h
+