aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitrij D. Czarkoff <czarkoff@gmail.com>2015-12-25 17:52:01 +0100
committerDmitrij D. Czarkoff <czarkoff@gmail.com>2015-12-25 17:52:01 +0100
commitc42ab088191d5dd8a2d856dc96cb5b3f90687fc4 (patch)
treef7a4b0fb2988f1cdc20c0527c7dd4fb63c7071ee
parent77827c838e36e39471f2f23338f76e5ace2404c4 (diff)
downloadimv-c42ab088191d5dd8a2d856dc96cb5b3f90687fc4.tar.gz
Add verbose mode
If V variable is set to any value, commands will be echoed to standard output.
-rw-r--r--Makefile14
-rw-r--r--README.md5
2 files changed, 13 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index fb3d07e..6ffa5c5 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,8 @@ BINPREFIX ?= $(PREFIX)/bin
MANPREFIX ?= $(PREFIX)/share/man
DATAPREFIX ?= $(PREFIX)/share
+V ?=
+
CFLAGS ?= -W -Wall -Wpedantic
CFLAGS += -std=gnu11 $(shell sdl2-config --cflags)
LDFLAGS += $(shell sdl2-config --libs) -lfreeimage -lSDL2_ttf -lfontconfig -lpthread
@@ -22,26 +24,26 @@ CFLAGS += -DIMV_VERSION=\"$(VERSION)\"
$(TARGET): $(OBJECTS)
@echo "LINKING $@"
- @$(CC) -o $@ $^ $(LDLIBS) $(LDFLAGS)
+ $(V:%=@)$(CC) -o $@ $^ $(LDLIBS) $(LDFLAGS)
debug: CFLAGS += -DDEBUG -g -pg
debug: $(TARGET)
$(BUILDDIR)/%.o: src/%.c
- @mkdir -p $(BUILDDIR)
+ $(V:%=@)mkdir -p $(BUILDDIR)
@echo "COMPILING $@"
- @$(CC) -c $(CFLAGS) -o $@ $<
+ $(V:%=@)$(CC) -c $(CFLAGS) -o $@ $<
test_%: test/%.c src/%.c
@echo "BUILDING $@"
- @$(CC) -o $@ -Isrc -W -Wall -std=gnu11 -lcmocka $^
+ $(V:%=@)$(CC) -o $@ -Isrc -W -Wall -std=gnu11 -lcmocka $^
check: $(TESTS)
@echo "RUNNING TESTS"
- @for t in "$(TESTS)"; do ./$$t; done
+ $(V:%=@)for t in "$(TESTS)"; do ./$$t; done
clean:
- @$(RM) $(TARGET) $(OBJECTS) $(TESTS)
+ $(V:%=@)$(RM) $(TARGET) $(OBJECTS) $(TESTS)
install: $(TARGET)
install -D -m 0755 $(TARGET) $(DESTDIR)$(BINPREFIX)/imv
diff --git a/README.md b/README.md
index 5c9c87b..7ed1ff3 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,11 @@ available. Eg. to install `imv` to home directory, run:
$ BINPREFIX=~/bin PREFIX=~/.local make install
+In case something goes wrong during installation process you may use verbose
+mode to inspect commands issued by make:
+
+ $ V=1 make
+
Tests
-----