aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-02-23 21:04:06 +0000
committerHarry Jeffery <harry@exec64.co.uk>2019-02-23 21:04:10 +0000
commitcd0684a2cbd4e68a51ef595c32c0faf1bf1ac41a (patch)
treef8839b2a666ad1b8bc6c390d76835f607bc9e76b
parent28eb7b50dcc91c2c869721d9c62095b7dc29f3cc (diff)
downloadimv-cd0684a2cbd4e68a51ef595c32c0faf1bf1ac41a.tar.gz
Makefile: Don't use $(wildcard)
-rw-r--r--Makefile36
-rw-r--r--src/backend_freeimage.c11
-rw-r--r--src/backend_libjpeg.c11
-rw-r--r--src/backend_libpng.c11
-rw-r--r--src/backend_librsvg.c11
-rw-r--r--src/backend_libtiff.c11
6 files changed, 28 insertions, 63 deletions
diff --git a/Makefile b/Makefile
index e868aa6..aaf09fa 100644
--- a/Makefile
+++ b/Makefile
@@ -16,40 +16,60 @@ override LIBS += -lSDL2_ttf -lfontconfig -lpthread
BUILDDIR ?= build
TARGET := $(BUILDDIR)/imv
-SOURCES := $(wildcard src/*.c)
-OBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES))
-TESTS := $(patsubst test/%.c,$(BUILDDIR)/test_%,$(wildcard test/*.c))
-
-VERSION != git describe --dirty --always --tags 2> /dev/null || echo v3.0.0
-
-override CPPFLAGS += -DIMV_VERSION=\""$(VERSION)"\"
+SOURCES := src/main.c
+
+SOURCES += src/binds.c
+SOURCES += src/bitmap.c
+SOURCES += src/commands.c
+SOURCES += src/image.c
+SOURCES += src/imv.c
+SOURCES += src/ini.c
+SOURCES += src/list.c
+SOURCES += src/navigator.c
+SOURCES += src/util.c
+SOURCES += src/viewport.c
# Add backends to build as configured
ifeq ($(BACKEND_FREEIMAGE),yes)
+ SOURCES += src/backend_freeimage.c
override CPPFLAGS += -DIMV_BACKEND_FREEIMAGE
override LIBS += -lfreeimage
endif
ifeq ($(BACKEND_LIBTIFF),yes)
+ SOURCES += src/backend_libtiff.c
override CPPFLAGS += -DIMV_BACKEND_LIBTIFF
override LIBS += -ltiff
endif
ifeq ($(BACKEND_LIBPNG),yes)
+ SOURCES += src/backend_libpng.c
override CPPFLAGS += -DIMV_BACKEND_LIBPNG
override LIBS += -lpng
endif
ifeq ($(BACKEND_LIBJPEG),yes)
+ SOURCES += src/backend_libjpeg.c
override CPPFLAGS += -DIMV_BACKEND_LIBJPEG
override LIBS += -lturbojpeg
endif
ifeq ($(BACKEND_LIBRSVG),yes)
+ SOURCES += src/backend_librsvg.c
override CPPFLAGS += -DIMV_BACKEND_LIBRSVG $(shell pkg-config --cflags librsvg-2.0)
override LIBS += $(shell pkg-config --libs librsvg-2.0)
endif
+
+TEST_SOURCES := test/list.c test/navigator.c
+
+OBJECTS := $(patsubst src/%.c,$(BUILDDIR)/%.o,$(SOURCES))
+TESTS := $(patsubst test/%.c,$(BUILDDIR)/test_%,$(TEST_SOURCES))
+
+VERSION != git describe --dirty --always --tags 2> /dev/null || echo v3.0.0
+
+override CPPFLAGS += -DIMV_VERSION=\""$(VERSION)"\"
+
TFLAGS ?= -g $(CFLAGS) $(CPPFLAGS) $(shell pkg-config --cflags cmocka)
TLIBS := $(LIBS) $(shell pkg-config --libs cmocka)
@@ -69,7 +89,7 @@ $(BUILDDIR):
$(BUILDDIR)/%.o: src/%.c Makefile
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
-$(BUILDDIR)/test_%: test/%.c $(filter-out src/main.c, $(wildcard src/*.c))
+$(BUILDDIR)/test_%: test/%.c $(filter-out src/main.c, $(SOURCES))
$(CC) -o $@ -Isrc $(TFLAGS) $^ $(LDFLAGS) $(TLIBS)
check: $(BUILDDIR) $(TESTS)
diff --git a/src/backend_freeimage.c b/src/backend_freeimage.c
index bb3c089..2cc386c 100644
--- a/src/backend_freeimage.c
+++ b/src/backend_freeimage.c
@@ -6,8 +6,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef IMV_BACKEND_FREEIMAGE
-
#include <FreeImage.h>
struct private {
@@ -342,12 +340,3 @@ const struct imv_backend *imv_backend_freeimage(void)
{
return &freeimage_backend;
}
-
-#else
-
-const struct imv_backend *imv_backend_freeimage(void)
-{
- return NULL;
-}
-
-#endif
diff --git a/src/backend_libjpeg.c b/src/backend_libjpeg.c
index ba3b1f9..d1e0b17 100644
--- a/src/backend_libjpeg.c
+++ b/src/backend_libjpeg.c
@@ -8,8 +8,6 @@
#include <unistd.h>
#include <fcntl.h>
-#ifdef IMV_BACKEND_LIBJPEG
-
#include <turbojpeg.h>
struct private {
@@ -227,12 +225,3 @@ const struct imv_backend *imv_backend_libjpeg(void)
{
return &libjpeg_backend;
}
-
-#else
-
-const struct imv_backend *imv_backend_libjpeg(void)
-{
- return NULL;
-}
-
-#endif
diff --git a/src/backend_libpng.c b/src/backend_libpng.c
index a4697c6..323139e 100644
--- a/src/backend_libpng.c
+++ b/src/backend_libpng.c
@@ -5,8 +5,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef IMV_BACKEND_LIBPNG
-
#include <png.h>
struct private {
@@ -206,12 +204,3 @@ const struct imv_backend *imv_backend_libpng(void)
{
return &libpng_backend;
}
-
-#else
-
-const struct imv_backend *imv_backend_libpng(void)
-{
- return NULL;
-}
-
-#endif
diff --git a/src/backend_librsvg.c b/src/backend_librsvg.c
index 86cbf00..984a351 100644
--- a/src/backend_librsvg.c
+++ b/src/backend_librsvg.c
@@ -5,8 +5,6 @@
#include <stdlib.h>
#include <string.h>
-#ifdef IMV_BACKEND_LIBRSVG
-
#include <librsvg/rsvg.h>
/* Some systems like GNU/Hurd don't define PATH_MAX */
@@ -210,12 +208,3 @@ const struct imv_backend *imv_backend_librsvg(void)
{
return &librsvg_backend;
}
-
-#else
-
-const struct imv_backend *imv_backend_librsvg(void)
-{
- return NULL;
-}
-
-#endif
diff --git a/src/backend_libtiff.c b/src/backend_libtiff.c
index a489cc1..82ce48e 100644
--- a/src/backend_libtiff.c
+++ b/src/backend_libtiff.c
@@ -8,8 +8,6 @@
#include <unistd.h>
#include <fcntl.h>
-#ifdef IMV_BACKEND_LIBTIFF
-
#include <tiffio.h>
struct private {
@@ -238,12 +236,3 @@ const struct imv_backend *imv_backend_libtiff(void)
{
return &libtiff_backend;
}
-
-#else
-
-const struct imv_backend *imv_backend_libtiff(void)
-{
- return NULL;
-}
-
-#endif