]> git.decadent.org.uk Git - videolink.git/blob - Makefile
Disabled prompts in batch processing mode.
[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) -lexpat
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 browser_widget.cpp child_iterator.cpp generate_dvd.cpp   \
35     link_iterator.cpp null_prompt_service.cpp pixbufs.cpp style_sheets.cpp \
36     temp_file.cpp video.cpp vob_list.cpp webdvd.cpp x_frame_buffer.cpp     \
37     xml_utils.cpp xpcom_support.cpp
38 csources := jquant2.c
39
40 webdvd : $(cxxsources:.cpp=.o) $(csources:.c=.o)
41         $(CXX) $(LDFLAGS) -o $@ $^
42
43 clean :
44         rm -f webdvd *.d *.o *~ .\#* *.orig *.rej svn-commit*.tmp
45
46 distclean : clean
47         rm -rf .svn
48
49 install :
50         mkdir -p -m 755 $(prefix)/bin $(prefix)/lib/webdvd
51         install -m 755 -s webdvd $(prefix)/bin
52         install -m 644 webdvd.css $(prefix)/lib/webdvd
53
54 .PHONY : clean distclean install
55
56 browser_widget.% : CPPFLAGS += -DMOZ_LIB_DIR='"$(moz_lib_dir)"'
57
58 webdvd.% \
59     : CPPFLAGS += -DWEBDVD_LIB_DIR='"$(webdvd_lib_dir)"'             \
60                   -DMOZ_VERSION_MAJOR=$(moz_version_major)           \
61                   -DMOZ_VERSION_MINOR=$(moz_version_minor)           \
62                   -DMOZ_VERSION_PATCHLEVEL=$(moz_version_patchlevel)
63
64 browser_widget.% generate_dvd.% pixbufs.% temp_file.% vob_list.% webdvd.% \
65     : CPPFLAGS += $(shell pkg-config --cflags gtkmm-2.0)
66
67 browser_widget.% child_iterator.o link_iterator.% null_prompt_service.% \
68 style_sheets.% webdvd.% xpcom_support.%                                 \
69     : CPPFLAGS += $(shell pkg-config --cflags mozilla-gtkmozembed)
70
71 # These dig a bit deeper into Mozilla
72 link_iterator.% style_sheets.% webdvd.%                                    \
73     : CPPFLAGS += $(addprefix -I$(moz_include_dir)/,                       \
74                     content docshell dom gfx layout necko webshell widget)
75
76 %.d : %.cpp
77         $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MM -MF $@ $<
78
79 %.d : %.c
80         $(CC) $(CFLAGS) $(CPPFLAGS) -MM -MF $@ $<
81
82 ifneq ($(MAKECMDGOALS),clean)
83     include $(cxxsources:.cpp=.d) $(csources:.c=.d)
84 endif