On Tue, 4 Jun 2013, Jed Brown wrote: > You should be able to do a multi-line definition, something like this: > > define ARCHIVE_RECIPE_CYGWIN > @$(RM) $@ [email protected] > @cygpath -w $^ > [email protected] > $(call quiet,AR) $(AR_FLAGS) $@ @`cygpath -w [email protected]` > $(call quiet,RANLIB) $@ > @$(RM) [email protected] > endef > > define ARCHIVE_RECIPE_DEFAULT > @$(RM) $@ > $(call quiet,AR) $(AR_FLAGS) $@ $^ > $(call quiet,RANLIB) $@ > endef > > %.$(AR_LIB_SUFFIX) : $$(obj) | $$(@D)/.DIR > $(if > $(PETSC_HAVE_CYGWIN),$(ARCHIVE_RECIPE_CYGWIN),$(ARCHIVE_RECIPE_DEFAULT))
I have the follwing patch to get the conditionals required for windows. PETSC_CYGWIN_BROKEN_PIPE is now required only for 'cygwin-ar' - so thats the first change. And then the ARCHIVE_RECIPE_WIN32FE_LIB is required only when 'win32fe lib' is the archiver. [In the future there could be others?] Instead of adding configure tests for these - I just added conditionals in the gmakefile. Satish --------- diff --git a/gmakefile b/gmakefile index bf9ce21..3dc4083 100644 --- a/gmakefile +++ b/gmakefile @@ -29,8 +29,10 @@ all : $(generated) $(libpetscall) #workarround old cygwin versions ifeq ($(PETSC_CYGWIN_BROKEN_PIPE),1) +ifeq ($(shell basename $(AR)),ar) V ?=1 endif +endif ifeq ($(V),) quiet_HELP := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n" quiet = @printf $(quiet_HELP)$(eval quiet_HELP:=)" %10s %s\n" "$1$2" "$@"; $($1) @@ -67,10 +69,21 @@ $(libpetsc_shared) : $(srcs.o) | $$(@D)/.DIR $(libpetsc_static) : obj := $(srcs.o) +define ARCHIVE_RECIPE_WIN32FE_LIB + @$(RM) $@ [email protected] + @cygpath -w $^ > [email protected] + $(call quiet,AR) $(AR_FLAGS) $@ @[email protected] + @$(RM) [email protected] +endef + +define ARCHIVE_RECIPE_DEFAULT + @$(RM) $@ + $(call quiet,AR) $(AR_FLAGS) $@ $^ + $(call quiet,RANLIB) $@ +endef + %.$(AR_LIB_SUFFIX) : $$(obj) | $$(@D)/.DIR - @$(RM) $@ - $(call quiet,AR) $(AR_FLAGS) $@ $^ - $(call quiet,RANLIB) $@ + $(if $(findstring win32fe lib,$(AR)),$(ARCHIVE_RECIPE_WIN32FE_LIB),$(ARCHIVE_RECIPE_DEFAULT)) # with-single-library=0 libpkg = $(foreach pkg, $1, $(LIBDIR)/libpetsc$(pkg).so)
