• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1ifndef BASE_NAME
2BASE_NAME	=	x86disasm
3endif
4
5ifndef SWIG
6SWIG		=	swig	# apt-get install swig !
7endif
8
9ifndef GCC
10GCC		=	gcc
11endif
12
13ifndef CC_FLAGS
14CC_FLAGS	=	-c -fPIC
15endif
16
17ifndef LD_FLAGS
18LD_FLAGS	=	-shared -L../.. -ldisasm
19endif
20
21INTERFACE_FILE	=	libdisasm.i
22
23SWIG_INTERFACE	=	../$(INTERFACE_FILE)
24
25# TCL rules
26TCL_VERSION	=	8.3
27TCL_MOD		=	$(BASE_NAME)-tcl.so
28TCL_SHADOW	=	$(BASE_NAME)_wrap.c
29TCL_OBJ		=	$(BASE_NAME)_wrap.o
30TCL_INC		=	/usr/include/tcl$(TCL_VERSION)
31TCL_LIB		=	/usr/lib/tcl$(TCL_VERSION)
32TCL_DEST	=	$(TCL_LIB)/$(BASE_NAME).so
33
34#====================================================
35# TARGETS
36
37all: swig-tcl
38
39dummy: swig-tcl install uninstall clean
40
41swig-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# ==================================================================
53install: $(TCL_MOD)
54	sudo cp $(TCL_MOD) $(TCL_DEST)
55
56# ==================================================================
57uninstall:
58
59# ==================================================================
60clean:
61	rm $(TCL_MOD) $(TCL_SWIG) $(TCL_OBJ)
62	rm $(TCL_SHADOW)
63
64