]> git.decadent.org.uk Git - videolink.git/blob - Makefile
989ef7d50271bcb58869ad5a49b2b9b2ba2d34ee
[videolink.git] / Makefile
1 prefix := /usr/local
2
3 webdvd_lib_dir := $(prefix)/lib/webdvd
4
5 moz_include_dir := \
6     $(shell pkg-config --variable=prefix mozilla-gtkmozembed)/include/mozilla
7 moz_lib_dir := \
8     $(shell pkg-config --variable=prefix mozilla-gtkmozembed)/lib/mozilla
9
10 moz_version := \
11     $(shell sed 's/\#define MOZILLA_VERSION "\(.*\)"/\1/; t; d' \
12             < $(moz_include_dir)/mozilla-config.h)
13 moz_version_major := $(word 1,$(subst ., ,$(moz_version)))
14 moz_version_minor := $(word 2,$(subst ., ,$(moz_version)))
15 moz_version_patchlevel := $(word 3,$(subst ., ,$(moz_version)))
16
17 CFLAGS := -Wall
18 CPPFLAGS := -D_REENTRANT
19 # Non-virtual destructors are fine in XPCOM interface classes since
20 # instances are only ever called by the Release function which is virtual.
21 CXXFLAGS := -Wall -Wno-non-virtual-dtor
22 LDFLAGS := -lpthread $(shell pkg-config --libs gtkmm-2.0 mozilla-gtkmozembed) \
23            -Wl,-rpath -Wl,$(moz_lib_dir)
24
25 ifdef NDEBUG
26     CPPFLAGS += -DNDEBUG
27 else
28     CFLAGS += -g
29     CXXFLAGS += -g
30     LDFLAGS += -g
31 endif
32
33 cxxsources := \
34     auto_proc.cpp browserwidget.cpp childiterator.cpp framebuffer.cpp \
35     linkiterator.cpp pixbufs.cpp stylesheets.cpp temp_file.cpp video.cpp \
36     webdvd.cpp xpcom_support.cpp
37 csources := jquant2.c
38
39 webdvd : $(cxxsources:.cpp=.o) $(csources:.c=.o)
40         $(CXX) $(LDFLAGS) -o $@ $^
41
42 clean :
43         rm -f webdvd *.d *.o *~ .\#* *.orig *.rej svn-commit*.tmp
44
45 distclean : clean
46         rm -rf .svn
47
48 install :
49         mkdir -p -m 755 $(prefix)/bin $(prefix)/lib/webdvd
50         install -m 755 -s webdvd $(prefix)/bin
51         install -m 644 webdvd.css $(prefix)/lib/webdvd
52
53 .PHONY : clean distclean install
54
55 browserwidget.% : CPPFLAGS += -DMOZ_LIB_DIR='"$(moz_lib_dir)"'
56
57 webdvd.% \
58     : CPPFLAGS += -DWEBDVD_LIB_DIR='"$(webdvd_lib_dir)"'             \
59                   -DMOZ_VERSION_MAJOR=$(moz_version_major)           \
60                   -DMOZ_VERSION_MINOR=$(moz_version_minor)           \
61                   -DMOZ_VERSION_PATCHLEVEL=$(moz_version_patchlevel)
62
63 browserwidget.% pixbufs.% temp_file.% webdvd.% \
64     : CPPFLAGS += $(shell pkg-config --cflags gtkmm-2.0)
65
66 browserwidget.% childiterator.o linkiterator.% stylesheets.% webdvd.% \
67 xpcom_support.%                                                       \
68     : CPPFLAGS += $(shell pkg-config --cflags mozilla-gtkmozembed)
69
70 # These dig a bit deeper into Mozilla
71 linkiterator.% stylesheets.% webdvd.%                                        \
72     : CPPFLAGS += $(addprefix -I$(moz_include_dir)/,                         \
73                     content docshell dom gfx layout necko webshell widget)
74
75 %.d : %.cpp
76         $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MM -MF $@ $<
77
78 %.d : %.c
79         $(CC) $(CFLAGS) $(CPPFLAGS) -MM -MF $@ $<
80
81 ifneq ($(MAKECMDGOALS),clean)
82     include $(cxxsources:.cpp=.d) $(csources:.c=.d)
83 endif