1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#----------------user/install options----------------
VERSION = 2.4
PROJECT = vimb
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
#----------------compile options---------------------
LIBS = libsoup-2.4
GTK3LIBS=gtk+-3.0 webkitgtk-3.0
GTK2LIBS=gtk+-2.0 webkit-1.0
ifeq (${GTK}, 3)
ifeq ($(shell pkg-config --exists $(GTK3LIBS) && echo 1), 1) #has gtk3 libs
LIBS += $(GTK3LIBS)
USEGTK3 = 1
else
LIBS += $(GTK2LIBS)
$(warning Cannot find gtk3-libs, falling back to gtk2)
endif
else
LIBS += $(GTK2LIBS)
endif
# generate a first char upper case project name
PROJECT_UCFIRST = $(shell echo '${PROJECT}' | awk '{for(i=1;i<=NF;i++){$$i=toupper(substr($$i,1,1))substr($$i,2)}}1')
CPPFLAGS = -DVERSION=\"${VERSION}\"
CPPFLAGS += -DPROJECT=\"${PROJECT}\" -DPROJECT_UCFIRST=\"${PROJECT_UCFIRST}\"
CPPFLAGS += -D_XOPEN_SOURCE=500
ifeq ($(USEGTK3), 1)
CPPFLAGS += -DHAS_GTK3
endif
# prepare the lib flags used for the linker
LIBFLAGS = $(shell pkg-config --libs $(LIBS))
# normal compiler flags
CFLAGS += $(shell pkg-config --cflags $(LIBS))
CFLAGS += -Wall -pipe -std=c99
CFLAGS += -Wno-overlength-strings -Werror=format-security
CFLAGS += ${CPPFLAGS}
LDFLAGS += ${LIBFLAGS}
# compiler flags for the debug target
DFLAGS += $(CFLAGS) -ggdb -g -O0
DLDFLAGS += ${LIBFLAGS}
OBJ = $(patsubst %.c, %.o, $(wildcard src/*.c))
DOBJ = $(patsubst %.c, %.do, $(wildcard src/*.c))
LOBJ = $(patsubst %.c, %.lo, $(wildcard src/*.c))
DEPS = $(OBJ:%.o=%.d)
TARGET = $(PROJECT)
DTARGET = $(TARGET)_dbg
LIBTARGET = lib$(PROJECT).so
DIST_FILE = $(PROJECT)_$(VERSION).tar.gz
MANDIR1 = $(MANDIR)/man1
MAN1 = $(PROJECT).1
MFLAGS =
|