• 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
21LIBDISASM_DIR	=	../..
22
23INTERFACE_FILE	=	libdisasm_oop.i
24
25SWIG_INTERFACE	=	../$(INTERFACE_FILE)
26
27# RUBY rules
28RUBY_MAKEFILE	=	Makefile
29RUBY_MOD	=	$(BASE_NAME).so
30RUBY_SHADOW	=	$(BASE_NAME)_wrap.c
31#RUBY_SWIG	=	$(BASE_NAME).rb
32RUBY_OBJ	=	$(BASE_NAME)_wrap.o
33RUBY_INC	=	`ruby -e 'puts $$:.join("\n")' | tail -2 | head -1`
34#RUBY_LIB	=
35#RUBY_DEST	=
36
37#====================================================
38# TARGETS
39
40all: swig-ruby
41
42dummy: swig-ruby install uninstall clean
43
44swig-ruby: $(RUBY_MOD)
45
46$(RUBY_MOD): $(RUBY_MAKEFILE)
47	make
48
49$(RUBY_MAKEFILE): $(RUBY_OBJ)
50	ruby extconf.rb
51
52$(RUBY_OBJ):$(RUBY_SHADOW)
53	$(GCC) $(CC_FLAGS) -I$(RUBY_INC) -I.. -o $@ $<
54
55$(RUBY_SHADOW): $(SWIG_INTERFACE)
56	swig -ruby -o $(RUBY_SHADOW) -outdir . $<
57
58# ==================================================================
59install: $(RUBY_MOD)
60	make install
61
62# ==================================================================
63uninstall:
64
65# ==================================================================
66clean:
67	make clean || true
68	rm $(RUBY_SHADOW) $(RUBY_MAKEFILE) $(RUBY_MOD) $(RUBY_OBJ)
69