summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakob <jakob@memeware.net>2017-03-02 19:17:14 -0500
committerjakob <jakob@memeware.net>2017-03-02 19:17:14 -0500
commited4c4e35658c9d2849ad6fde9c9a423323026a53 (patch)
tree279671b1f8359438287fa613ad63b808a7163678
parent0e67a05edcc3ba01221a6bfd14750b5b8090887f (diff)
First alpha release of version 2.0.0
-rw-r--r--Makefile44
-rw-r--r--README.md6
-rw-r--r--src/main.c2
-rw-r--r--test/test_header.c6
-rw-r--r--test/test_run.c1
5 files changed, 41 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 98dc49e..4837e6d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,42 @@
+ifneq (,)
+Terribly sorry, this makefile requires gmake.
+endif
+
+CC := gcc
+LD := gcc
+
CFLAGS = -Wall -Wextra -Os
LDFLAGS = -lz
-OBJ = obj/cli.o obj/compress.o obj/crypto.o obj/encoding.o obj/header.o obj/io.o obj/table.o
-TEST_OBJ = obj/test_cli.o obj/test_encoding.o obj/test_header.o obj/test_io.o obj/test_table.o obj/test_run.o
-ENTRY_OBJ = obj/main.o
+SRCDIR = src
+TSTDIR = test
+OBJDIR = obj
+BINDIR = bin
+
+TESTS := $(wildcard $(TSTDIR)/*.c)
+TEST_OBJECTS := $(TESTS:$(TSTDIR)/%.c=$(OBJDIR)/%.o)
+SOURCES := $(filter-out $(SRCDIR)/main.c, $(wildcard $(SRCDIR)/*.c))
+OBJECTS := $(filter-out $(OBJDIR)/main.o, $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o))
+
+all: $(BINDIR)/nekopack
-all: bin/nekopack
+$(BINDIR)/nekopack: $(OBJECTS) $(OBJDIR)/main.o
+ $(LD) $(LDFLAGS) $(OBJECTS) $(OBJDIR)/main.o -o bin/nekopack
-bin/nekopack: $(OBJ) $(ENTRY_OBJ)
- cc $(LDFLAGS) $(OBJ) $(ENTRY_OBJ) -o bin/nekopack
+$(BINDIR)/test: $(OBJECTS) $(TEST_OBJECTS)
+ $(LD) $(LDFLAGS) $(OBJECTS) $(TEST_OBJECTS) -o $(BINDIR)/test
+
+$(OBJDIR)/%.o: src/%.c
+ $(CC) $(CFLAGS) -c -o $@ $(SRCDIR)/$*.c
+
+$(OBJDIR)/%.o: test/%.c
+ $(CC) $(CFLAGS) -c -o $@ -I $(SRCDIR) $(TSTDIR)/$*.c
test: bin/test
bin/test
-bin/test: $(OBJ) $(TEST_OBJ)
- cc $(LDFLAGS) $(OBJ) $(TEST_OBJ) -o bin/test
-
-obj/%.o: src/%.c
- cc $(CFLAGS) -c -o $@ src/$*.c
+clean:
+ rm -f bin/* obj/*
-obj/%.o: test/%.c
- cc -I src $(CFLAGS) -c -o $@ test/$*.c
+.PHONY: clean test
diff --git a/README.md b/README.md
index 1786a6c..a5e719e 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,11 @@ Nekopack is free software, licensed under the [GNU General Public License.](http
Compilation
-----------
-Nekopack can be compiled by running `make` from the repository's root directory.
+Nekopack can be compiled on Linux by running `make` from the repository's root directory.
+
+*BSD users will have to install and run `gmake` to build Nekopack.
+
+The test suite can be run with `make test` or `gmake test`.
TODO
diff --git a/src/main.c b/src/main.c
index d135f15..da9a835 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,7 +30,7 @@
#include "io.h"
#include "table.h"
-#define VERSION_STR "2.0.0b1"
+#define VERSION_STR "2.0.0a1"
/* Pointer to a function to be mapped to entries in the table. */
typedef void (*mapfn)(struct stream *archive, struct table_entry *e,
diff --git a/test/test_header.c b/test/test_header.c
index 908d889..2df2b0f 100644
--- a/test/test_header.c
+++ b/test/test_header.c
@@ -29,10 +29,10 @@ extern int tests_run;
char *test_header_read(void) {
- struct stream *s = stream_new(sizeof(struct xp3_header));
- memset(s->_start, '\x00', sizeof(struct xp3_header));
+ struct stream *s = stream_new(sizeof(struct header));
+ memset(s->_start, '\x00', sizeof(struct header));
- struct xp3_header *h = read_header(s);
+ struct header *h = read_header(s);
mu_assert("Header assertions failed", h == NULL);
stream_rewind(s);
diff --git a/test/test_run.c b/test/test_run.c
index f1bf07e..42183c4 100644
--- a/test/test_run.c
+++ b/test/test_run.c
@@ -21,6 +21,7 @@
#include "minunit.h"
+#include "test_cli.h"
#include "test_encoding.h"
#include "test_header.h"
#include "test_io.h"