sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

Makefile (2058B)


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