"ldopts" was spelled wrong, but we don't really want it here.
[thrasher.git] / Makefile
blobc4ae66d00f4aac483198a73c335f4a8056e26e58
1 ### "config" options
2 PERL = /usr/bin/perl
3 GLIB_PREFIX = /usr
4 PURPLE_PREFIX = /usr
5 ### end of build config
7 PERL_CFLAGS := $(shell PERL5LIB= $(PERL) -MExtUtils::Embed -e ccopts)
9 ifeq ($(PERL_CFLAGS),)
10 $(error "Cannot find PERL_CFLAGS. Do you have ExtUtils::Embed?")
11 endif
13 PERL_LIBS := \
14 $(shell PERL5LIB= $(PERL) -MExtUtils::Embed -e ldopts) \
15 $(shell PERL5LIB= $(PERL) -MConfig -e'print "-L$$Config::Config{archlibexp}/CORE";')
17 GLIB_CFLAGS = -I$(GLIB_PREFIX)/include/glib-2.0 \
18 -I$(GLIB_PREFIX)/include/glib-2.0/glib \
19 -I$(GLIB_PREFIX)/lib/glib-2.0/include \
20 -I$(PURPLE_PREFIX)/include/libpurple \
21 -DPURPLE_DISABLE_DEPRECATED \
22 $(PERL_CFLAGS)
24 GLIB_LIBS := -L$(GLIB_PREFIX)/lib \
25 -lpurple \
26 -lgobject-2.0 \
27 -lgmodule-2.0 \
28 -lgthread-2.0 \
29 -lglib-2.0 \
30 -lrt
32 CFLAGS = -Wall \
33 -Waggregate-return \
34 -Wcast-align \
35 -Werror-implicit-function-declaration \
36 -Wmissing-declarations \
37 -Wmissing-prototypes \
38 -Wnested-externs \
39 -Wpointer-arith \
40 -Wundef \
41 -O2
43 DEBUG_CFLAGS = -DTH_DEBUG \
44 -DERROR_DEBUG
46 DEBUG_GLIB = -g \
47 -ggdb
49 DEPDIR = .deps
50 OBJS = thperl.o \
51 thblist.o \
52 thrasher.o \
53 thpresence.o \
54 thconnection.o \
55 threquest.o \
56 thconversations.o \
57 thft.o
59 COMPILE = gcc -DHAVE_CONFIG_H -I. $(GLIB_CFLAGS) $(DEBUG_CFLAGS) $(CFLAGS)
60 WRAPPER = THPPW
61 WRAPPER_PATH = perl/lib
64 .PHONY: clean again
66 all: $(DEPDIR) $(OBJS) thperl_wrap.c wrapper
68 wrapper: $(WRAPPER_PATH)/$(WRAPPER).pm thperl_wrap.o $(WRAPPER).so
70 thperl_wrap.o: thperl_wrap.c
71 $(CC) $(DEBUG_CFLAGS) $(DEBUG_GLIB) -fPIC -c thperl.c thperl_wrap.c -fPIC $(GLIB_CFLAGS)
73 $(WRAPPER).so: $(OBJS) thperl_wrap.o
74 $(CC) -shared $(GLIB_LIBS) $(PERL_LIBS) $(OBJS) thperl_wrap.o -o $(WRAPPER).so
76 thperl_wrap.c $(WRAPPER_PATH)/$(WRAPPER).pm: thperl.h
77 swig -I$(PURPLE_PREFIX)/include $(DEBUG_CFLAGS) -perl -outdir $(WRAPPER_PATH) thperl.h
79 $(DEPDIR):
80 if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
82 .c.o:
83 $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
84 mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
86 again: clean all
88 clean:
89 $(RM) -f $(OBJS)
90 $(RM) -rf $(DEPDIR)
91 $(RM) -f thperl_wrap.*
92 $(RM) -f $(WRAPPER).so
93 $(RM) -f $(WRAPPER_PATH)/$(WRAPPER).pm $(WRAPPER).pm