| 1 | all: sxiv |
| 2 | |
| 3 | VERSION=git-20110129 |
| 4 | |
| 5 | CC?=gcc |
| 6 | PREFIX?=/usr/local |
| 7 | CFLAGS+= -std=c99 -Wall -pedantic -DVERSION=\"$(VERSION)\" |
| 8 | LDFLAGS+= |
| 9 | LIBS+= -lX11 -lImlib2 |
| 10 | |
| 11 | SRCFILES=$(wildcard *.c) |
| 12 | OBJFILES=$(SRCFILES:.c=.o) |
| 13 | |
| 14 | sxiv: $(OBJFILES) |
| 15 | $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) |
| 16 | |
| 17 | %.o: %.c Makefile config.h |
| 18 | $(CC) $(CFLAGS) -c -o $@ $< |
| 19 | |
| 20 | install: all |
| 21 | install -D -m 4755 -o root -g root sxiv $(PREFIX)/bin/sxiv |
| 22 | mkdir -p $(PREFIX)/share/man/man1 |
| 23 | sed "s/VERSION/$(VERSION)/g" sxiv.1 > $(PREFIX)/share/man/man1/sxiv.1 |
| 24 | chmod 644 $(PREFIX)/share/man/man1/sxiv.1 |
| 25 | |
| 26 | clean: |
| 27 | rm -f sxiv *.o |
| 28 | |
| 29 | tags: *.h *.c |
| 30 | ctags $^ |
| 31 | |
| 32 | cscope: *.h *.c |
| 33 | cscope -b |