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.i 22 23 SWIG_INTERFACE = ../$(INTERFACE_FILE) 24 25 # TCL rules 26 TCL_VERSION = 8.3 27 TCL_MOD = $(BASE_NAME)-tcl.so 28 TCL_SHADOW = $(BASE_NAME)_wrap.c 29 TCL_OBJ = $(BASE_NAME)_wrap.o 30 TCL_INC = /usr/include/tcl$(TCL_VERSION) 31 TCL_LIB = /usr/lib/tcl$(TCL_VERSION) 32 TCL_DEST = $(TCL_LIB)/$(BASE_NAME).so 33 34 #==================================================== 35 # TARGETS 36 37 all: swig-tcl 38 39 dummy: swig-tcl install uninstall clean 40 41 swig-tcl: $(TCL_MOD) 42 43 $(TCL_MOD): $(TCL_OBJ) 44 $(GCC) $(LD_FLAGS) $(TCL_OBJ) -o $@ 45 46 $(TCL_OBJ): $(TCL_SHADOW) 47 $(GCC) $(CC_FLAGS) -I$(TCL_INC) -I.. -o $@ $< 48 49 $(TCL_SHADOW): $(SWIG_INTERFACE) 50 swig -tcl -o $(TCL_SHADOW) -outdir . $< 51 52 # ================================================================== 53 install: $(TCL_MOD) 54 sudo cp $(TCL_MOD) $(TCL_DEST) 55 56 # ================================================================== 57 uninstall: 58 59 # ================================================================== 60 clean: 61 rm $(TCL_MOD) $(TCL_SWIG) $(TCL_OBJ) 62 rm $(TCL_SHADOW) 63 64