1 ifndef BASE_NAME 2 BASE_NAME = x86disasm 3 endif 4 5 ifndef SWIG 6 SWIG = swig # apt-get install swig ! 7 endif 8 9 ifndef GCC 10 GCC = gcc 11 endif 12 13 ifndef CC_FLAGS 14 CC_FLAGS = -c -fPIC 15 endif 16 17 ifndef LD_FLAGS 18 LD_FLAGS = -shared -L.. -ldisasm 19 endif 20 21 INTERFACE_FILE = libdisasm_oop.i 22 23 SWIG_INTERFACE = ../$(INTERFACE_FILE) 24 25 # PERL rules 26 PERL_MOD = blib/arch/auto/$(BASE_NAME)/$(BASE_NAME).so 27 PERL_SHADOW = $(BASE_NAME)_wrap.c 28 PERL_SWIG = $(BASE_NAME).pl 29 PERL_OBJ = $(BASE_NAME)_wrap.o 30 PERL_INC = `perl -e 'use Config; print $$Config{archlib};'`/CORE 31 PERL_CC_FLAGS = `perl -e 'use Config; print $$Config{ccflags};'` 32 33 #==================================================== 34 # TARGETS 35 36 all: swig-perl 37 38 dummy: swig-perl install uninstall clean 39 40 swig-perl: $(PERL_MOD) 41 42 $(PERL_MOD): $(PERL_OBJ) 43 perl Makefile.PL 44 make 45 #$(GCC) $(LD_FLAGS) $(PERL_OBJ) -o $@ 46 47 $(PERL_OBJ): $(PERL_SHADOW) 48 $(GCC) $(CC_FLAGS) $(PERL_CC_FLAGS) -I$(PERL_INC) -o $@ $< 49 50 $(PERL_SHADOW): $(SWIG_INTERFACE) 51 swig -perl -shadow -o $(PERL_SHADOW) -outdir . $< 52 53 # ================================================================== 54 install: $(PERL_MOD) 55 make install 56 57 # ================================================================== 58 uninstall: 59 60 # ================================================================== 61 clean: 62 rm $(PERL_MOD) $(PERL_OBJ) 63 rm $(PERL_SHADOW) 64 rm -rf Makefile blib pm_to_blib 65 66