#-*- Makefile -*- .SUFFIXES: .c .cc .cpp .C .f .o .a .def .exp .dll .exe .d # Alternatives CYGWIN (-mno-cygwin), MINGW32 (mingw32 gcc), CROSS (Linux) BUILD=MINGW32 # Set this to YES if you use MINGW32 and gcc-2.95.2.1 or later, or cygwin-1.1. # HAVE_SHARED=YES # Where does 'HTML Help Workshop' live? (unused if compiled HTML help is # not requested. Spaces allowed.) HHWDIR=C:/Program Files/HTML Help Workshop # Where does Tcl/Tk live? Spaces allowed. TCL_HOME = c:/packages/Tcl TCL_VERSION = 83 ifeq ($(strip $(BUILD)),CYGWIN) BINPREF= MINGW32CFLAG= -mno-cygwin -DWIN32 MINGW32LDFLAG= -mno-cygwin #-L(directory where gcc-2.95.2-mingw-extra.tar.gz was uncompressed) # is needed with earlier versions of cygwin. FLIBS=-lg2c AWK=gawk endif ifeq ($(strip $(BUILD)),MINGW32) BINPREF= MINGW32CFLAG= MINGW32LDFLAG= FLIBS=-lg2c AWK=gawk endif ifeq ($(strip $(BUILD)),CROSS) # Next two might be i386-mingw32- or i586- depending on the cross-compiler. BINPREF=i386-mingw32msvc- # Set this to where the mingw32 include files are HEADER=/packages/R-X/i386-mingw32msvc/include MINGW32CFLAG=-isystem $(HEADER) MINGW32LDFLAG= FLIBS=-lg2c AWK=awk endif PERL=perl RM=rm -f SED=sed ECHO=echo CP=cp MKDIR=mkdir CAT=cat CC=$(BINPREF)gcc $(MINGW32CFLAG) CXX=$(BINPREF)g++ $(MINGW32CFLAG) F77=$(BINPREF)g77 AS=$(BINPREF)as DLL_LDMAIN=gcc DLL=$(BINPREF)$(DLL_LDMAIN) $(MINGW32LDFLAG) DLLTOOL=$(BINPREF)dlltool -k --as $(AS) LINKER=$(BINPREF)gcc $(MINGW32LDFLAG) AR=$(BINPREF)ar RANLIB=$(BINPREF)ranlib NM=$(BINPREF)nm CPP=$(CC) -E RESCOMP=$(BINPREF)windres .c.o: $(CC) $(CFLAGS) $($*-CFLAGS) -c $< -o $@ .f.o: $(F77) $(FFLAGS) $($*-FFLAGS) -c $< -o $@ .cc.o: $(CXX) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@ .cpp.o: $(CXX) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@ .C.o: $(CXX) $(CXXFLAGS) $($*-CXXFLAGS) -c $< -o $@ %.exe: $(LINKER) $(LINKFLAGS) $($*-LINKFLAGS) -o $@ $^ $($*-LIBS) $(LIBS) %.dll %.def: @$(ECHO) ------- Building $@ from $^ -------- $(ECHO) LIBRARY $* > $*.def $(ECHO) EXPORTS >> $*.def $(NM) $^ > Defs $(SED) -n '/^........ [BCDRT] _/s/^........ [BCDRT] _/ /p' Defs >> $*.def $(RM) Defs ifeq ($(strip $(HAVE_SHARED)),YES) $(DLL) --shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.def $^ $($*-DLLLIBS) $(DLLLIBS) else $(DLL) -mdll -Wl,--base-file,$*.b $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $^ $($*-DLLLIBS) $(DLLLIBS) $(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $@ --base-file $*.b --output-exp $*.e --def $*.def $(DLL) -mdll -Wl,--base-file,$*.b $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.e $^ $($*-DLLLIBS) $(DLLLIBS) $(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $@ --base-file $*.b --output-exp $*.e --def $*.def $(DLL) -mdll $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.e $^ $($*-DLLLIBS) $(DLLLIBS) $(RM) $*.b $*.e endif lib%.a: %.def @$(ECHO) -------- Building $@ from $^ -------- $(DLLTOOL) $(DLLTOOLFLAGS) $($*-DLLTOOLFLAGS) --dllname $*.dll --def $*.def --output-lib lib$*.a %.a: @$(ECHO) -------- Building $@ from $^ -------- $(AR) cr $@ $^ $(RANLIB) $@ %.o: %.rc $(RESCOMP) $(RESFLAGS) $($*-RESFLAGS) -i $< -o $@