diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 70 |
1 files changed, 38 insertions, 32 deletions
@@ -1,6 +1,12 @@ # first entries are for gnu make, 2nd for BSD make. see http://lists.uzbl.org/pipermail/uzbl-dev-uzbl.org/2009-July/000177.html -REQ_PKGS = libsoup-2.4 gthread-2.0 glib-2.0 +# packagers, set DESTDIR to your "package directory" and PREFIX to the prefix you want to have on the end-user system +# end-users who build from source: don't care about DESTDIR, update PREFIX if you want to +# RUN_PREFIX : what the prefix is when the software is run. usually the same as PREFIX +PREFIX?=/usr/local +INSTALLDIR?=$(DESTDIR)$(PREFIX) +DOCDIR?=$(INSTALLDIR)/share/uzbl/docs +RUN_PREFIX?=$(PREFIX) # gtk2 REQ_PKGS += gtk+-2.0 webkit-1.0 @@ -8,53 +14,58 @@ CPPFLAGS = # gtk3 #REQ_PKGS += gtk+-3.0 webkitgtk-3.0 -#CPPFLAG = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED +#CPPFLAGS = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED + +# --- configuration ends here --- + +REQ_PKGS += libsoup-2.4 gthread-2.0 glib-2.0 + +ARCH:=$(shell uname -m) +ARCH!=echo `uname -m` + +COMMIT_HASH:=$(shell ./misc/hash.sh) +COMMIT_HASH!=echo `./misc/hash.sh` + +CPPFLAGS += -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\" -CFLAGS:=-std=c99 $(shell pkg-config --cflags $(REQ_PKGS)) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./misc/hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic -CFLAGS!=echo -std=c99 `pkg-config --cflags $(REQ_PKGS)` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./misc/hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +PKG_CFLAGS:=$(shell pkg-config --cflags $(REQ_PKGS)) +PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) -UZBL_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) -pthread $(LDFLAGS) -UZBL_LDFLAGS!=echo `pkg-config --libs $(REQ_PKGS) x11` -pthread $(LDFLAGS) +LDLIBS:=$(shell pkg-config --libs $(REQ_PKGS) x11) +LDLIBS!=echo pkg-config --libs $(REQ_PKGS) x11 + +CFLAGS += -std=c99 $(PKG_CFLAGS) -ggdb -W -Wall -Wextra -pedantic -pthread SRC = $(wildcard src/*.c) HEAD = $(wildcard src/*.h) -OBJ = $(foreach obj, $(SRC:.c=.o), $(notdir $(obj))) +OBJ = $(foreach obj, $(SRC:.c=.o), $(notdir $(obj))) +LOBJ = $(foreach obj, $(SRC:.c=.lo), $(notdir $(obj))) all: uzbl-browser uzbl-cookie-manager VPATH:=src -.c.o: - @echo -e "${CC} -c ${CFLAGS} $<" - @${CC} -c ${CFLAGS} $< - ${OBJ}: ${HEAD} uzbl-core: ${OBJ} - @echo -e "\n${CC} -o $@ ${OBJ} ${UZBL_LDFLAGS}" - @${CC} -o $@ ${OBJ} ${UZBL_LDFLAGS} -uzbl-cookie-manager: examples/uzbl-cookie-manager.o src/util.o - @echo -e "\n${CC} -o $@ uzbl-cookie-manager.o util.o ${LDFLAGS} ${shell pkg-config --libs glib-2.0 libsoup-2.4}" - @${CC} -o $@ uzbl-cookie-manager.o util.o ${LDFLAGS} $(shell pkg-config --libs glib-2.0 libsoup-2.4) +uzbl-cookie-manager: examples/uzbl-cookie-manager.o util.o + @echo -e "\n${CC} -o $@ examples/uzbl-cookie-manager.o util.o ${shell pkg-config --libs glib-2.0 libsoup-2.4}" + @${CC} -o $@ examples/uzbl-cookie-manager.o util.o $(shell pkg-config --libs glib-2.0 libsoup-2.4) uzbl-browser: uzbl-core uzbl-cookie-manager -# packagers, set DESTDIR to your "package directory" and PREFIX to the prefix you want to have on the end-user system -# end-users who build from source: don't care about DESTDIR, update PREFIX if you want to -# RUN_PREFIX : what the prefix is when the software is run. usually the same as PREFIX -PREFIX?=/usr/local -INSTALLDIR?=$(DESTDIR)$(PREFIX) -DOCDIR?=$(INSTALLDIR)/share/uzbl/docs -RUN_PREFIX?=$(PREFIX) - # the 'tests' target can never be up to date .PHONY: tests force: +# this is here because the .so needs to be compiled with -fPIC on x86_64 +${LOBJ}: ${SRC} ${HEAD} + $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c src/$(@:.lo=.c) -o $@ + # When compiling unit tests, compile uzbl as a library first -tests: ${OBJ} force - $(CC) -shared -Wl ${OBJ} -o ./tests/libuzbl-core.so +tests: ${LOBJ} force + $(CC) -shared -Wl ${LOBJ} -o ./tests/libuzbl-core.so cd ./tests/; $(MAKE) test-uzbl-core: uzbl-core @@ -100,12 +111,7 @@ test-uzbl-tabbed-sandbox: uzbl-browser clean: rm -f uzbl-core rm -f uzbl-cookie-manager - rm -f uzbl-core.o - rm -f events.o - rm -f callbacks.o - rm -f inspector.o - rm -f cookie-jar.o - rm -f util.o + rm -f *.o *.lo find ./examples/ -name "*.pyc" -delete cd ./tests/; $(MAKE) clean rm -rf ./sandbox/ |