Krolyxon
Commit b752d5c

Branches

Refs →

nsxivMakefile

53 lines · 1.3 KB · Makefile

1VERSION = git-20120215
2
3CC = gcc
4CFLAGS = -ansi -Wall -pedantic -O2
5LDFLAGS =
6LIBS = -lX11 -lImlib2 -lgif
7
8PREFIX = /usr/local
9MANPREFIX = $(PREFIX)/share/man
10
11SRC = commands.c image.c main.c options.c thumbs.c util.c window.c
12OBJ = $(SRC:.c=.o)
13
14all: options sxiv
15
16options:
17 @echo "sxiv build options:"
18 @echo "CC = $(CC)"
19 @echo "CFLAGS = $(CFLAGS)"
20 @echo "LDFLAGS = $(LDFLAGS)"
21 @echo "PREFIX = $(PREFIX)"
22
23.c.o:
24 @echo "CC $<"
25 @$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
26
27$(OBJ): Makefile config.h
28
29config.h:
30 @echo "creating $@ from config.def.h"
31 @cp config.def.h $@
32
33sxiv: $(OBJ)
34 @echo "CC -o $@"
35 @$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
36
37clean:
38 @echo "cleaning"
39 @rm -f $(OBJ) sxiv sxiv-$(VERSION).tar.gz
40
41install: all
42 @echo "installing executable file to $(DESTDIR)$(PREFIX)/bin"
43 @install -D -m 755 sxiv $(DESTDIR)$(PREFIX)/bin/sxiv
44 @echo "installing manual page to $(DESTDIR)$(MANPREFIX)/man1"
45 @mkdir -p $(DESTDIR)$(MANPREFIX)/man1
46 @sed "s/VERSION/$(VERSION)/g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
47 @chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
48
49uninstall:
50 @echo "removing executable file from $(DESTDIR)$(PREFIX)/bin"
51 @rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
52 @echo "removing manual page from $(DESTDIR)$(MANPREFIX)/man1"
53 @rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1