1# See LICENSE file for copyright and license details 2# farbfeld - suckless image format with conversion tools 3.POSIX: 4 5include config.mk 6 7REQ = util 8HDR = arg.h 9BIN = png2ff ff2png jpg2ff ff2jpg ff2pam ff2ppm 10SCR = 2ff 11MAN1 = 2ff.1 $(BIN:=.1) 12MAN5 = farbfeld.5 13 14all: $(BIN) 15 16png2ff-LDLIBS = $(PNG-LDLIBS) 17ff2png-LDLIBS = $(PNG-LDLIBS) 18jpg2ff-LDLIBS = $(JPG-LDLIBS) 19ff2jpg-LDLIBS = $(JPG-LDLIBS) 20 21png2ff: png2ff.o $(REQ:=.o) 22ff2png: ff2png.o $(REQ:=.o) 23jpg2ff: jpg2ff.o $(REQ:=.o) 24ff2jpg: ff2jpg.o $(REQ:=.o) 25ff2pam: ff2pam.o $(REQ:=.o) 26ff2ppm: ff2ppm.o $(REQ:=.o) 27 28png2ff.o: png2ff.c config.mk $(HDR) $(REQ:=.h) 29ff2png.o: ff2png.c config.mk $(HDR) $(REQ:=.h) 30jpg2ff.o: jpg2ff.c config.mk $(HDR) $(REQ:=.h) 31ff2jpg.o: ff2jpg.c config.mk $(HDR) $(REQ:=.h) 32ff2pam.o: ff2pam.c config.mk $(HDR) $(REQ:=.h) 33ff2ppm.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 41clean: 42 rm -f $(BIN) $(BIN:=.o) $(REQ:=.o) 43 44dist: 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 53install: 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 64uninstall: 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 68