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

Guido Masarotto guido at sirio.stat.unipd.it
Mon Jun 8 19:43:31 CEST 1998

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
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
DLL=gcc -mdll  

	@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) 
	  --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)
	 --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

	@echo -------- Building $@ from $^ --------
	ar cr $@ $^
	ranlib $@

	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


zero.a: zero.o

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

	$(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 at stat.math.ethz.ch

More information about the R-help mailing list