Instead of spamming, do everything ridiculously slowly.
[thrasher.git] / Makefile
blobc52fc3d7d1e8a7d21f6dd6fc0ebb8ee9229ef93d
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)
8 PERL_CFLAGS := $(subst -Wdeclaration-after-statement,,$(PERL_CFLAGS))
10 ifeq ($(PERL_CFLAGS),)
11 $(error "Cannot find PERL_CFLAGS. Do you have ExtUtils::Embed?")
12 endif
14 PERL_LIBS := \
15 $(shell PERL5LIB= $(PERL) -MExtUtils::Embed -e ldopts) \
16 $(shell PERL5LIB= $(PERL) -MConfig -e'print "-L$$Config::Config{archlibexp}/CORE";')
18 GLIB_CFLAGS = -I$(GLIB_PREFIX)/include/glib-2.0 \
19 -I$(GLIB_PREFIX)/include/glib-2.0/glib \
20 -I$(GLIB_PREFIX)/lib/glib-2.0/include \
21 -I$(PURPLE_PREFIX)/include/libpurple \
22 -DPURPLE_DISABLE_DEPRECATED \
23 $(PERL_CFLAGS)
25 GLIB_LIBS := -L$(GLIB_PREFIX)/lib \
26 -lpurple \
27 -lgobject-2.0 \
28 -lgmodule-2.0 \
29 -lgthread-2.0 \
30 -lglib-2.0 \
31 -lrt
33 CFLAGS = -Wall \
34 -Waggregate-return \
35 -Wcast-align \
36 -Werror-implicit-function-declaration \
37 -Wmissing-declarations \
38 -Wmissing-prototypes \
39 -Wnested-externs \
40 -Wpointer-arith \
41 -Wundef \
42 -O2
44 DEBUG_CFLAGS = -DTH_DEBUG \
45 -DERROR_DEBUG
47 DEBUG_GLIB = -g \
48 -ggdb
50 DEPDIR = .deps
51 OBJS = thperl.o \
52 thblist.o \
53 thrasher.o \
54 thpresence.o \
55 thconnection.o \
56 threquest.o \
57 thconversations.o \
58 thft.o
60 COMPILE = gcc -DHAVE_CONFIG_H -I. $(GLIB_CFLAGS) $(DEBUG_CFLAGS) $(CFLAGS)
61 WRAPPER = THPPW
62 WRAPPER_PATH = perl/lib
65 .PHONY: clean again
67 all: $(DEPDIR) $(OBJS) thperl_wrap.c wrapper
69 wrapper: $(WRAPPER_PATH)/$(WRAPPER).pm thperl_wrap.o $(WRAPPER).so
71 thperl_wrap.o: thperl_wrap.c
72 $(CC) $(DEBUG_CFLAGS) $(DEBUG_GLIB) -fPIC -c thperl.c thperl_wrap.c -fPIC $(GLIB_CFLAGS)
74 $(WRAPPER).so: $(OBJS) thperl_wrap.o
75 $(CC) -shared $(GLIB_LIBS) $(PERL_LIBS) $(OBJS) thperl_wrap.o -o $(WRAPPER).so
77 thperl_wrap.c $(WRAPPER_PATH)/$(WRAPPER).pm: thperl.h
78 swig -I$(PURPLE_PREFIX)/include $(DEBUG_CFLAGS) -perl -outdir $(WRAPPER_PATH) thperl.h
80 $(DEPDIR):
81 if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
83 .c.o:
84 $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
85 mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
87 again: clean all
89 clean:
90 $(RM) -f $(OBJS)
91 $(RM) -rf $(DEPDIR)
92 $(RM) -f thperl_wrap.*
93 $(RM) -f $(WRAPPER).so
94 $(RM) -f $(WRAPPER_PATH)/$(WRAPPER).pm $(WRAPPER).pm