Re: R-beta: makefile command line for recreating dynload demo dll

Guido Masarotto (guido@sirio.stat.unipd.it)
Mon, 8 Jun 1998 18:43:31 +0100


Date: Mon, 8 Jun 1998 18:43:31 +0100
From: Guido Masarotto <guido@sirio.stat.unipd.it>
To: r-help@stat.math.ethz.ch
Subject: Re: R-beta: makefile command line for recreating dynload demo dll
In-Reply-To: <W0u9sBA2YZe1EwMI@dsteele.demon.co.uk>; from Douglas Steele on Sat, Jun 06, 1998 at 08:19:18PM +0100

On Sat, Jun 06, 1998 at 08:19:18PM +0100, Douglas Steele wrote:
> Hi,
> 
> I have gnuwin32 (b18) and the rw0613b.zip version of R.
> 
> With regards to (re)making the dynload dll demo given (zero.dll) could
> anyone tell me what the command line for the makefile should be.
> ie,
> 
> make -f Makefile.in ...?


The enclosed makefile does the job with egcs-mingw32. I suppose
that it should (+/-) work also with the cygnus version of gcc
but I cannot test it. 
Just, put it in the demos/dynload directory and type
> make
Observe that all the rules come from the files (in particular MkRules) in
rw0613s.zip. 
guido m.
ps. Forget Makefile.in. I left it there and I apologize for this
since it is a base Makefile for building a shared library under Unix.

------------------------------------------------------------------------
..SUFFIXES: .c .f .o .a  .def .dll .exe .lib 

all: libiR.a zero.dll

RM=rm -f
CC=gcc
DLL=gcc -mdll  
DLLTOOL=dlltool


..c.o:
	@echo -------- Building $@ from $< --------
	$(CC)  $(CFLAGS) $($*-CFLAGS) -o $@  -c $<
	



%.dll %.def:  %.a 0.o  
	@echo ------- Building $@ from $^ --------
	echo LIBRARY $* > $*.def
	echo EXPORTS >> $*.def
	nm $*.a | sed -n "/^........ [DT] _/s/^........ [BCDRT] _/ /p" >> $*.def
	$(DLL) -Wl,--base-file,0.b $(DLLFLAGS) $($*-DLLFLAGS) -o $@  $*.a  0.o $($*-DLLLIBS) $(DLLLIBS) 
	$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $@ \
	  --base-file 0.b --output-exp 0.e --def $*.def
	$(DLL)  -Wl,--base-file,0.b $(DLLFLAGS) $($*-DLLFLAGS) -o $@ 0.e $*.a 0.o $($*-DLLLIBS) $(DLLLIBS)
	$(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $@ \
	 --base-file 0.b --output-exp 0.e --def $*.def 
	$(DLL)  $(DLLFLAGS) $($*-DLLFLAGS) -o $@  0.e $*.a  0.o \
	 $($*-DLLLIBS) $(DLLLIBS)	     
	$(RM)  0.b 0.e



%.a:    
	@echo -------- Building $@ from $^ --------
	ar cr $@ $^
	ranlib $@


0.o:
	echo asm(".section .idata$$3\n" ".long 0,0,0,0,0,0,0,0")END > 0.c
	gcc -DEND=\; -c 0.c
	rm 0.c




DLLLIBS=libiR.a
DLLFLAGS=-s


zero.a: zero.o

libiR.a: R.def
	dlltool --dllname R.exe  --output-lib libiR.a --def R.def
	
R.def:
	echo EXPORTS > R.def
	echo call_S  >> R.def
	echo error   >> R.def


clean:
	$(RM) *.a *.def *.o *~


veryclean: clean
	$(RM) *.dll 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._