You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

89 lines
2.0 KiB

  1. version = 25+
  2. srcdir = .
  3. VPATH = $(srcdir)
  4. PREFIX = /usr/local
  5. MANPREFIX = $(PREFIX)/share/man
  6. # autoreload backend: inotify/nop
  7. AUTORELOAD = inotify
  8. # enable features requiring giflib (-lgif)
  9. HAVE_GIFLIB = 1
  10. # enable features requiring libexif (-lexif)
  11. HAVE_LIBEXIF = 1
  12. cflags = -std=c99 -Wall -pedantic $(CFLAGS)
  13. cppflags = -I. $(CPPFLAGS) -D_XOPEN_SOURCE=700 \
  14. -DHAVE_GIFLIB=$(HAVE_GIFLIB) -DHAVE_LIBEXIF=$(HAVE_LIBEXIF) \
  15. -I/usr/include/freetype2 -I$(PREFIX)/include/freetype2
  16. lib_exif_0 =
  17. lib_exif_1 = -lexif
  18. lib_gif_0 =
  19. lib_gif_1 = /usr/lib/libgif.so
  20. ldlibs = $(LDLIBS) -lImlib2 -lX11 -lXft -lfontconfig \
  21. $(lib_exif_$(HAVE_LIBEXIF)) $(lib_gif_$(HAVE_GIFLIB))
  22. objs = autoreload_$(AUTORELOAD).o commands.o image.o main.o options.o \
  23. thumbs.o util.o window.o
  24. all: sxiv
  25. .PHONY: all clean install uninstall
  26. .SUFFIXES:
  27. .SUFFIXES: .c .o
  28. $(V).SILENT:
  29. sxiv: $(objs)
  30. @echo "LINK $@"
  31. $(CC) $(LDFLAGS) -o $@ $(objs) $(ldlibs)
  32. $(objs): Makefile sxiv.h commands.lst config.h
  33. options.o: version.h
  34. window.o: icon/data.h
  35. .c.o:
  36. @echo "CC $@"
  37. $(CC) $(cflags) $(cppflags) -c -o $@ $<
  38. config.h:
  39. @echo "GEN $@"
  40. cp $(srcdir)/config.def.h $@
  41. version.h: Makefile .git/index
  42. @echo "GEN $@"
  43. v="$$(cd $(srcdir); git describe 2>/dev/null)"; \
  44. echo "#define VERSION \"$${v:-$(version)}\"" >$@
  45. .git/index:
  46. clean:
  47. rm -f *.o sxiv
  48. install: all
  49. @echo "INSTALL bin/sxiv"
  50. mkdir -p $(DESTDIR)$(PREFIX)/bin
  51. cp sxiv $(DESTDIR)$(PREFIX)/bin/
  52. chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv
  53. @echo "INSTALL sxiv.1"
  54. mkdir -p $(DESTDIR)$(MANPREFIX)/man1
  55. sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(version)!g" sxiv.1 \
  56. >$(DESTDIR)$(MANPREFIX)/man1/sxiv.1
  57. chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
  58. @echo "INSTALL share/sxiv/"
  59. mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec
  60. cp exec/* $(DESTDIR)$(PREFIX)/share/sxiv/exec/
  61. chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/*
  62. uninstall:
  63. @echo "REMOVE bin/sxiv"
  64. rm -f $(DESTDIR)$(PREFIX)/bin/sxiv
  65. @echo "REMOVE sxiv.1"
  66. rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1
  67. @echo "REMOVE share/sxiv/"
  68. rm -rf $(DESTDIR)$(PREFIX)/share/sxiv