aboutsummaryrefslogtreecommitdiff
path: root/src/third_party/libdisasm/swig/perl/Makefile-swig
blob: 9f3a64573317d35d78817d0932364baf1ab0da43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
ifndef BASE_NAME
BASE_NAME	=	x86disasm
endif

ifndef SWIG
SWIG		=	swig	# apt-get install swig !
endif

ifndef GCC
GCC		=	gcc
endif

ifndef CC_FLAGS
CC_FLAGS	=	-c -fPIC
endif

ifndef LD_FLAGS
LD_FLAGS	=	-shared -L.. -ldisasm
endif

INTERFACE_FILE	=	libdisasm_oop.i

SWIG_INTERFACE	=	../$(INTERFACE_FILE)

# PERL rules
PERL_MOD	=	blib/arch/auto/$(BASE_NAME)/$(BASE_NAME).so
PERL_SHADOW	=	$(BASE_NAME)_wrap.c
PERL_SWIG	=	$(BASE_NAME).pl
PERL_OBJ	=	$(BASE_NAME)_wrap.o
PERL_INC	=	`perl -e 'use Config; print $$Config{archlib};'`/CORE
PERL_CC_FLAGS	=	`perl -e 'use Config; print $$Config{ccflags};'`

#====================================================
# TARGETS

all: swig-perl

dummy: swig-perl install uninstall clean

swig-perl: $(PERL_MOD)

$(PERL_MOD): $(PERL_OBJ)
	perl Makefile.PL
	make
	#$(GCC) $(LD_FLAGS) $(PERL_OBJ) -o $@

$(PERL_OBJ): $(PERL_SHADOW)
	$(GCC) $(CC_FLAGS) $(PERL_CC_FLAGS) -I$(PERL_INC) -o $@ $<

$(PERL_SHADOW): $(SWIG_INTERFACE)
	swig -perl -shadow -o $(PERL_SHADOW) -outdir . $<

# ==================================================================
install: $(PERL_MOD)
	make install

# ==================================================================
uninstall:

# ==================================================================
clean: 
	rm $(PERL_MOD) $(PERL_OBJ)
	rm $(PERL_SHADOW)
	rm -rf Makefile blib pm_to_blib