From 900194edee61b6dded593e04b435e9b7c9ca0517 Mon Sep 17 00:00:00 2001 From: Aaron Peschel Date: Wed, 30 Nov 2011 21:06:11 -0800 Subject: [PATCH] Made project more in line with Autotools standard. --- Makefile | 37 ++++++++++++++++++++++++-- src/Makefile | 15 +++++++++++ nyancat.c => src/nyancat.c | 0 nyancat.py => src/nyancat.py | 0 telnetsrvlib.py => src/telnetsrvlib.py | 0 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/Makefile rename nyancat.c => src/nyancat.c (100%) rename nyancat.py => src/nyancat.py (100%) rename telnetsrvlib.py => src/telnetsrvlib.py (100%) diff --git a/Makefile b/Makefile index 8d1c3ae..58ef75b 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,35 @@ -nyancat: nyancat.c - gcc -o nyancat nyancat.c +package = nyancat +version = 0.1 +tarname = $(package) +distdir = $(tarname)-$(version) + +all clean check parser: + cd src && $(MAKE) $@ + +dist: $(distdir).tar.gz + +$(distdir).tar.gz: $(distdir) + tar chof - $(distdir) | gzip -9 -c > $@ + rm -rf $(distdir) + +$(distdir): FORCE + mkdir -p $(distdir)/src + cp Makefile $(distdir) + cp src/Makefile $(distdir)/src + cp src/nyancat.c $(distdir)/src + cp src/nyancat.py $(distdir)/src + cp src/telnetsrvlib.py $(distdir)/src + +FORCE: + -rm $(distdir).tar.gz >/dev/null 2>&1 + -rm -rf $(distdir) >/dev/null 2>&1 + +distcheck: $(distdir).tar.gz + gzip -cd $(distdir).tar.gz | tar xvf - + cd $(distdir) && $(MAKE) all + cd $(distdir) && $(MAKE) check + cd $(distdir) && $(MAKE) clean + rm -rf $(distdir) + @echo "*** Package $(distdir).tar.gz is ready for distribution." + +.PHONY: FORCE all clean check dist distcheck diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..1701c11 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,15 @@ +OBJECTS = nyancat.o + +all: nyancat + +nyancat: $(OBJECTS) + $(CC) $(LFLAGS) $(OBJECTS) -o $@ + +clean: + -rm -f $(OBJECTS) nyancat + +check: all + # Unit tests go here. None currently. + @echo "*** ALL TESTS PASSED ***" + +.PHONY: all clean check diff --git a/nyancat.c b/src/nyancat.c similarity index 100% rename from nyancat.c rename to src/nyancat.c diff --git a/nyancat.py b/src/nyancat.py similarity index 100% rename from nyancat.py rename to src/nyancat.py diff --git a/telnetsrvlib.py b/src/telnetsrvlib.py similarity index 100% rename from telnetsrvlib.py rename to src/telnetsrvlib.py