Makefile (2016B)
1 # See LICENSE file for copyright and license details 2 # farbfeld - suckless image format with conversion tools 3 .POSIX: 4 5 include config.mk 6 7 REQ = util 8 HDR = arg.h 9 BIN = png2ff ff2png jpg2ff ff2jpg ff2pam ff2ppm 10 SCR = 2ff 11 MAN1 = 2ff.1 $(BIN:=.1) 12 MAN5 = farbfeld.5 13 14 all: $(BIN) 15 16 png2ff-LDLIBS = $(PNG-LDLIBS) 17 ff2png-LDLIBS = $(PNG-LDLIBS) 18 jpg2ff-LDLIBS = $(JPG-LDLIBS) 19 ff2jpg-LDLIBS = $(JPG-LDLIBS) 20 21 png2ff: png2ff.o $(REQ:=.o) 22 ff2png: ff2png.o $(REQ:=.o) 23 jpg2ff: jpg2ff.o $(REQ:=.o) 24 ff2jpg: ff2jpg.o $(REQ:=.o) 25 ff2pam: ff2pam.o $(REQ:=.o) 26 ff2ppm: ff2ppm.o $(REQ:=.o) 27 28 png2ff.o: png2ff.c config.mk $(HDR) $(REQ:=.h) 29 ff2png.o: ff2png.c config.mk $(HDR) $(REQ:=.h) 30 jpg2ff.o: jpg2ff.c config.mk $(HDR) $(REQ:=.h) 31 ff2jpg.o: ff2jpg.c config.mk $(HDR) $(REQ:=.h) 32 ff2pam.o: ff2pam.c config.mk $(HDR) $(REQ:=.h) 33 ff2ppm.o: ff2ppm.c config.mk $(HDR) $(REQ:=.h) 34 35 .o: 36 $(CC) -o $@ $(LDFLAGS) $< $(REQ:=.o) $($*-LDLIBS) 37 38 .c.o: 39 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< 40 41 clean: 42 rm -f $(BIN) $(BIN:=.o) $(REQ:=.o) 43 44 dist: 45 rm -rf "farbfeld-$(VERSION)" 46 mkdir -p "farbfeld-$(VERSION)" 47 cp -R FORMAT LICENSE Makefile README config.mk $(SCR) \ 48 $(HDR) $(BIN:=.c) $(REQ:=.c) $(REQ:=.h) \ 49 $(MAN1) $(MAN5) "farbfeld-$(VERSION)" 50 tar -cf - "farbfeld-$(VERSION)" | gzip -c > "farbfeld-$(VERSION).tar.gz" 51 rm -rf "farbfeld-$(VERSION)" 52 53 install: all 54 mkdir -p "$(DESTDIR)$(PREFIX)/bin" 55 cp -f $(SCR) $(BIN) "$(DESTDIR)$(PREFIX)/bin" 56 for f in $(BIN) $(SCR); do chmod 755 "$(DESTDIR)$(PREFIX)/bin/$$f"; done 57 mkdir -p "$(DESTDIR)$(MANPREFIX)/man1" 58 cp -f $(MAN1) "$(DESTDIR)$(MANPREFIX)/man1" 59 for m in $(MAN1); do chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/$$m"; done 60 mkdir -p "$(DESTDIR)$(MANPREFIX)/man5" 61 cp -f $(MAN5) "$(DESTDIR)$(MANPREFIX)/man5" 62 for m in $(MAN5); do chmod 644 "$(DESTDIR)$(MANPREFIX)/man5/$$m"; done 63 64 uninstall: 65 for f in $(BIN) $(SCR); do rm -f "$(DESTDIR)$(PREFIX)/bin/$$f"; done 66 for m in $(MAN1); do rm -f "$(DESTDIR)$(MANPREFIX)/man1/$$m"; done 67 for m in $(MAN5); do rm -f "$(DESTDIR)$(MANPREFIX)/man5/$$m"; done