From dc706aa912db6799421749dd573be04a1a5429a4 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Sat, 5 Mar 2011 22:11:08 +0100 Subject: [PATCH] Updated Makefiles (not finished) --- Makefile | 6 ++++-- config.mk | 4 ++-- ft/Makefile | 18 ++++++++++++++++++ ft/djvu/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ ft/djvu/config.mk | 21 +++++++++++++++++++++ ft/pdf/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ ft/pdf/config.mk | 21 +++++++++++++++++++++ zathura.h | 2 +- 8 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 ft/Makefile create mode 100644 ft/djvu/Makefile create mode 100644 ft/djvu/config.mk create mode 100644 ft/pdf/Makefile create mode 100644 ft/pdf/config.mk diff --git a/Makefile b/Makefile index c3efd9d..4152c2c 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ # See LICENSE file for license and copyright information -# zathura - user interface include config.mk PROJECT = zathura -SOURCE = $(shell find . -iname "*.c" -a ! -iwholename "*./doc*|*./ft*") +SOURCE = $(shell find . -iname "*.c" -a ! -iwholename "*./ft*") OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) DOBJECTS = $(patsubst %.c, %.do, $(SOURCE)) all: options ${PROJECT} + make -C ft options: @echo ${PROJECT} build options: @@ -35,12 +35,14 @@ ${PROJECT}: ${OBJECTS} clean: @rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \ ${DOBJECTS} ${PROJECT}-debug + make -C ft clean ${PROJECT}-debug: ${DOBJECTS} @echo CC -o ${PROJECT}-debug @${CC} ${LDFLAGS} -o ${PROJECT}-debug ${DOBJECTS} ${LIBS} debug: ${PROJECT}-debug + make -C ft debug valgrind: debug valgrind --tool=memcheck --leak-check=yes --show-reachable=yes \ diff --git a/config.mk b/config.mk index a6a4747..086388e 100644 --- a/config.mk +++ b/config.mk @@ -8,8 +8,8 @@ PREFIX ?= /usr MANPREFIX ?= ${PREFIX}/share/man # libs -GTK_INC = $(shell pkg-config --cflags gtk+-2.0 poppler-glib ddjvuapi) -GTK_LIB = $(shell pkg-config --libs gtk+-2.0 gthread-2.0 poppler-glib ddjvuapi) +GTK_INC = $(shell pkg-config --cflags gtk+-2.0) +GTK_LIB = $(shell pkg-config --libs gtk+-2.0 gthread-2.0) INCS = -I. -I/usr/include ${GTK_INC} LIBS = -lc ${GTK_LIB} -lpthread -lm -lgirara -ldl diff --git a/ft/Makefile b/ft/Makefile new file mode 100644 index 0000000..2e3e593 --- /dev/null +++ b/ft/Makefile @@ -0,0 +1,18 @@ +# See LICENSE file for license and copyright information + +SUBDIRS = $(shell find -mindepth 2 -maxdepth 2 -iname "Makefile" -exec dirname '{}' \;) + +all: + @for dir in ${SUBDIRS}; do ${MAKE} -C $${dir}; done + +debug: + @for dir in ${SUBDIRS}; do ${MAKE} -C $${dir} clean; done + +clean: + @for dir in ${SUBDIRS}; do ${MAKE} -C $${dir} clean; done + +install: + @for dir in ${SUBDIRS}; do ${MAKE} -C $${dir} install; done + +uninstall: + @for dir in ${SUBDIRS}; do ${MAKE} -C $${dir} uninstall; done diff --git a/ft/djvu/Makefile b/ft/djvu/Makefile new file mode 100644 index 0000000..02cabfe --- /dev/null +++ b/ft/djvu/Makefile @@ -0,0 +1,42 @@ +# See LICENSE file for license and copyright information + +include config.mk + +PLUGIN = djvu +SOURCE = djvu.c +OBJECTS = ${SOURCE:.c=.o} +DOBJECTS = ${SOURCE:.c=.do} + +all: options ${PLUGIN} + +options: + @echo ${PLUGIN} build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "DFLAGS = ${DFLAGS}" + @echo "CC = ${CC}" + +%.o: %.c + @echo CC $< + @${CC} -c ${CFLAGS} -o $@ $< + +%.do: %.c + @echo CC $< + @${CC} -c ${CFLAGS} ${DFLAGS} -o $@ $< + +${OBJECTS}: config.mk +${DOBJECTS}: config.mk + +${PLUGIN}: ${OBJECTS} + @echo LD $@ + @${LD} -shared ${LDFLAGS} -o ${PLUGIN}.so $(OBJECTS) + +${PLUGIN}-debug: ${DOBJECTS} + @echo LD $@ + @${LD} -shared ${LDFLAGS} -o ${PLUGIN}-debug.so $(DOBJECTS) + +clean: + @rm -rf ${OBJECTS} ${DOBJECTS} $(PLUGIN).so ${PLUGIN}-debug.so + +debug: options ${PLUGIN}-debug + @make -C debug diff --git a/ft/djvu/config.mk b/ft/djvu/config.mk new file mode 100644 index 0000000..54154b3 --- /dev/null +++ b/ft/djvu/config.mk @@ -0,0 +1,21 @@ +# See LICENSE file for license and copyright information + +# paths +PREFIX ?= /usr + +# libs +DJVU_INC = $(shell pkg-config --cflags gtk+-2.0 ddjvuapi) +DJVU_LIB = $(shell pkg-config --libs gtk+-2.0 ddjvuapi) + +INCS = -I. -I/usr/include ${DJVU_INC} +LIBS = -lc ${DJVU_LIB} + +# flags +CFLAGS += -std=c99 -fPIC -pedantic -Wall -Wno-format-zero-length $(INCS) + +# debug +DFLAGS = -g + +# compiler +CC ?= gcc +LD ?= ld diff --git a/ft/pdf/Makefile b/ft/pdf/Makefile new file mode 100644 index 0000000..ce038cb --- /dev/null +++ b/ft/pdf/Makefile @@ -0,0 +1,42 @@ +# See LICENSE file for license and copyright information + +include config.mk + +PLUGIN = pdf +SOURCE = pdf.c +OBJECTS = ${SOURCE:.c=.o} +DOBJECTS = ${SOURCE:.c=.do} + +all: options ${PLUGIN} + +options: + @echo ${PLUGIN} build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "DFLAGS = ${DFLAGS}" + @echo "CC = ${CC}" + +%.o: %.c + @echo CC $< + @${CC} -c ${CFLAGS} -o $@ $< + +%.do: %.c + @echo CC $< + @${CC} -c ${CFLAGS} ${DFLAGS} -o $@ $< + +${OBJECTS}: config.mk +${DOBJECTS}: config.mk + +${PLUGIN}: ${OBJECTS} + @echo LD $@ + @${LD} -shared ${LDFLAGS} -o ${PLUGIN}.so $(OBJECTS) + +${PLUGIN}-debug: ${DOBJECTS} + @echo LD $@ + @${LD} -shared ${LDFLAGS} -o ${PLUGIN}-debug.so $(DOBJECTS) + +clean: + @rm -rf ${OBJECTS} ${DOBJECTS} $(PLUGIN).so ${PLUGIN}-debug.so + +debug: options ${PLUGIN}-debug + @make -C debug diff --git a/ft/pdf/config.mk b/ft/pdf/config.mk new file mode 100644 index 0000000..2e505e9 --- /dev/null +++ b/ft/pdf/config.mk @@ -0,0 +1,21 @@ +# See LICENSE file for license and copyright information + +# paths +PREFIX ?= /usr + +# libs +PDF_INC = $(shell pkg-config --cflags gtk+-2.0 poppler-glib) +PDF_LIB = $(shell pkg-config --libs gtk+-2.0 poppler-glib) + +INCS = -I. -I/usr/include ${PDF_INC} +LIBS = -lc ${PDF_LIB} + +# flags +CFLAGS += -std=c99 -fPIC -pedantic -Wall -Wno-format-zero-length $(INCS) + +# debug +DFLAGS = -g + +# compiler +CC ?= gcc +LD ?= ld diff --git a/zathura.h b/zathura.h index 2002e27..3052e32 100644 --- a/zathura.h +++ b/zathura.h @@ -5,8 +5,8 @@ #include #include -#include +#include "render.h" #include "document.h" enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,