Home | History | Annotate | Download | only in ruby
      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 LIBDISASM_DIR	=	../..
     22 
     23 INTERFACE_FILE	=	libdisasm_oop.i
     24 
     25 SWIG_INTERFACE	=	../$(INTERFACE_FILE)
     26 
     27 # RUBY rules
     28 RUBY_MAKEFILE	=	Makefile
     29 RUBY_MOD	=	$(BASE_NAME).so
     30 RUBY_SHADOW	=	$(BASE_NAME)_wrap.c
     31 #RUBY_SWIG	=	$(BASE_NAME).rb
     32 RUBY_OBJ	=	$(BASE_NAME)_wrap.o
     33 RUBY_INC	=	`ruby -e 'puts $$:.join("\n")' | tail -2 | head -1`
     34 #RUBY_LIB	=	
     35 #RUBY_DEST	=	
     36 
     37 #====================================================
     38 # TARGETS
     39 
     40 all: swig-ruby
     41 
     42 dummy: swig-ruby install uninstall clean
     43 
     44 swig-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 # ==================================================================
     59 install: $(RUBY_MOD)
     60 	make install
     61 
     62 # ==================================================================
     63 uninstall:
     64 
     65 # ==================================================================
     66 clean: 
     67 	make clean || true
     68 	rm $(RUBY_SHADOW) $(RUBY_MAKEFILE) $(RUBY_MOD) $(RUBY_OBJ)
     69