Krolyxon
Commit 8a652a7

Branches

Refs →

nsxivMakefile

55 lines · 1.4 KB · Makefile

1VERSION = git-20120816
2
3PREFIX = /usr/local
4MANPREFIX = $(PREFIX)/share/man
5
6CC = gcc
7CFLAGS = -ansi -Wall -pedantic -O2 -I$(PREFIX)
8LDFLAGS = -L$(PREFIX)
9LIBS = -lX11 -lImlib2 -lgif
10
11SRC = commands.c exif.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 @mkdir -p $(DESTDIR)$(PREFIX)/bin
44 @cp -f sxiv $(DESTDIR)$(PREFIX)/bin/
45 @chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
46 @echo "installing manual page to $(DESTDIR)$(MANPREFIX)/man1"
47 @mkdir -p $(DESTDIR)$(MANPREFIX)/man1
48 @sed "s/VERSION/$(VERSION)/g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
49 @chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
50
51uninstall:
52 @echo "removing executable file from $(DESTDIR)$(PREFIX)/bin"
53 @rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
54 @echo "removing manual page from $(DESTDIR)$(MANPREFIX)/man1"
55 @rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1