1 | # $Id$ |
---|
2 | |
---|
3 | srcdir = @srcdir@ |
---|
4 | VPATH = @srcdir@ |
---|
5 | prefix = @prefix@ |
---|
6 | exec_prefix = @exec_prefix@ |
---|
7 | datadir = @datadir@/barnowl |
---|
8 | bindir = @bindir@ |
---|
9 | mandir = @mandir@ |
---|
10 | |
---|
11 | CC=@CC@ |
---|
12 | LIBS=@LIBS@ |
---|
13 | CFLAGS=@CFLAGS@ -DDATADIR=\"${datadir}\" -DOWL_SVN_REVNO=$(shell ./svkversion) |
---|
14 | LDFLAGS=@LDFLAGS@ |
---|
15 | XSUBPPDIR=@XSUBPPDIR@ |
---|
16 | XSUBPPFLAGS=@XSUBPPFLAGS@ |
---|
17 | INSTALL=@INSTALL@ |
---|
18 | INSTALL_PROGRAM=@INSTALL_PROGRAM@ |
---|
19 | INSTALL_DATA=@INSTALL_DATA@ |
---|
20 | ATHSTATIC=@ATHSTATIC@ |
---|
21 | |
---|
22 | BASE_SRCS=list.c message.c mainwin.c popwin.c zephyr.c messagelist.c \ |
---|
23 | commands.c global.c text.c fmtext.c editwin.c util.c logging.c \ |
---|
24 | perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \ |
---|
25 | regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ |
---|
26 | keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \ |
---|
27 | timer.c style.c errqueue.c \ |
---|
28 | zbuddylist.c muxevents.c popexec.c obarray.c select.c wcwidth.c \ |
---|
29 | glib_compat.c |
---|
30 | OWL_SRC = owl.c |
---|
31 | TESTER_SRC = tester.c |
---|
32 | |
---|
33 | EXE = barnowl |
---|
34 | PERL_MODULES = Jabber |
---|
35 | MODULE_DIRS = $(PERL_MODULES:%=perl/modules/%) |
---|
36 | |
---|
37 | BASE_OBJS = $(BASE_SRCS:.c=.o) |
---|
38 | |
---|
39 | GEN_C = varstubs.c perlglue.c perlwrap.c |
---|
40 | GEN_H = owl_prototypes.h |
---|
41 | GEN_O = $(GEN_C:.c=.o) |
---|
42 | |
---|
43 | OBJS = $(BASE_OBJS) $(GEN_O) |
---|
44 | |
---|
45 | AUTOGEN=$(GEN_C) $(GEN_H) |
---|
46 | #AUTOGEN=$(GEN_C) |
---|
47 | |
---|
48 | HEADERS=$(GEN_H) owl.h config.h test.h |
---|
49 | |
---|
50 | all: $(EXE) $(MODULE_DIRS) |
---|
51 | |
---|
52 | $(EXE): $(AUTOGEN) $(OBJS) owl.o |
---|
53 | $(ATHSTATIC) $(CC) -o $(EXE) owl.o $(OBJS) $(LDFLAGS) $(LIBS) |
---|
54 | |
---|
55 | tester: $(AUTOGEN) $(OBJS) tester.o |
---|
56 | $(ATHSTATIC) $(CC) -o tester tester.o $(OBJS) $(LDFLAGS) $(LIBS) |
---|
57 | |
---|
58 | %.o: %.c $(HEADERS) |
---|
59 | $(CC) -c $(CFLAGS) $< -o $@ |
---|
60 | |
---|
61 | # zcrypt is old crufty DES code I don't want to touch |
---|
62 | # Disable all warnings when compiling it |
---|
63 | zcrypt.o: zcrypt.c $(HEADERS) |
---|
64 | $(CC) -c $(CFLAGS) $< -w -o $@ |
---|
65 | |
---|
66 | test: tester |
---|
67 | ./tester reg |
---|
68 | |
---|
69 | clean: modules_clean |
---|
70 | $(RM) $(EXE) tester *.o $(AUTOGEN) owl_prototypes.h.new |
---|
71 | |
---|
72 | distclean: clean |
---|
73 | $(RM) config.cache config.log config.status Makefile config.h TAGS *~ core |
---|
74 | |
---|
75 | .PHONY: $(MODULE_DIRS) |
---|
76 | |
---|
77 | modules: $(MODULE_DIRS) |
---|
78 | modules_clean: |
---|
79 | for i in $(MODULE_DIRS); do \ |
---|
80 | cd $$i; test ! -f Makefile || make clean; \ |
---|
81 | done |
---|
82 | |
---|
83 | $(MODULE_DIRS): %: %/Makefile |
---|
84 | ( cd $@ && make $(notdir $@).par ) |
---|
85 | |
---|
86 | $(MODULE_DIRS:=/Makefile): %/Makefile: %/Makefile.PL |
---|
87 | ( cd $(dir $@) && perl -I../../lib Makefile.PL ) |
---|
88 | |
---|
89 | proto: owl_prototypes.h |
---|
90 | |
---|
91 | perlglue.c: perlglue.xs Makefile |
---|
92 | perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs > perlglue.c |
---|
93 | |
---|
94 | varstubs.c: variable.c stubgen.pl |
---|
95 | perl stubgen.pl > varstubs.c |
---|
96 | |
---|
97 | perlwrap.c: perlwrap.pm encapsulate.pl |
---|
98 | perl encapsulate.pl perlwrap.pm owl_perlwrap_codebuff > perlwrap.c |
---|
99 | |
---|
100 | # Only move owl_prototypes.h into place if the new one is different |
---|
101 | owl_prototypes.h: codelist.pl varstubs.c $(BASE_SRCS) |
---|
102 | perl codelist.pl > owl_prototypes.h.new |
---|
103 | @cmp -s owl_prototypes.h.new $@ || { \ |
---|
104 | test -f $@ && echo 'Interfaces changed!'; \ |
---|
105 | echo mv -f owl_prototypes.h.new $@; \ |
---|
106 | mv -f owl_prototypes.h.new $@; } |
---|
107 | #owl_prototypes.h: |
---|
108 | |
---|
109 | .PHONY: tags clean distclean proto test check-syntax |
---|
110 | |
---|
111 | tags: TAGS |
---|
112 | |
---|
113 | TAGS: $(BASE_SRCS) $(OWL_SRC) $(TESTER_SRC) $(GEN_C) owl.h $(GEN_H) |
---|
114 | etags $(BASE_SRCS) $(OWL_SRC) $(TESTER_SRC) $(GEN_C) owl.h $(GEN_H) |
---|
115 | |
---|
116 | $(BASE_OBJS) varstubs.h: owl.h config.h owl_prototypes.h |
---|
117 | |
---|
118 | install: all installdirs |
---|
119 | ${INSTALL_PROGRAM} $(EXE) ${DESTDIR}${bindir}/$(EXE) |
---|
120 | ${INSTALL_DATA} doc/owl.1 ${DESTDIR}${mandir}/man1/barnowl.1 |
---|
121 | ${INSTALL} -d ${DESTDIR}${datadir}/lib |
---|
122 | ${INSTALL} -d ${DESTDIR}${datadir}/modules |
---|
123 | tar -C perl/lib --exclude .svn -cf - . | tar -C ${DESTDIR}${datadir}/lib -xf - |
---|
124 | for i in $(PERL_MODULES); do \ |
---|
125 | ${INSTALL_DATA} perl/modules/$$i/$$i.par ${DESTDIR}${datadir}/modules/$$i.par; \ |
---|
126 | done |
---|
127 | |
---|
128 | installdirs: mkinstalldirs |
---|
129 | ${srcdir}/mkinstalldirs ${DESTDIR}${bindir} ${DESTDIR}${mandir}/man1 ${DESTDIR}${datadir} |
---|
130 | |
---|
131 | # For emacs flymake-mode |
---|
132 | check-syntax: proto |
---|
133 | $(CC) $(CFLAGS) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES) |
---|