#
# ${R_HOME}/src/extra/xz/Makefile

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@

top_builddir = ../../..
subdir = src/extra/xz
R_HOME = $(top_builddir)

include $(top_builddir)/Makeconf

LZMA_CPPFLAGS = -I$(srcdir)/api
ALL_CPPFLAGS = $(LZMA_CPPFLAGS) $(R_XTRA_CPPFLAGS) $(CPPFLAGS) $(DEFS)

SOURCES = \
 alone_decoder.c alone_encoder.c arm.c armthumb.c auto_decoder.c \
 block_buffer_decoder.c block_buffer_encoder.c block_decoder.c \
 block_encoder.c block_header_decoder.c block_header_encoder.c block_util.c \
 check.c common.c crc32_fast.c crc32_table.c crc32_tablegen.c \
 crc64_fast.c crc64_table.c crc64_tablegen.c delta_common.c delta_decoder.c \
 delta_encoder.c easy_buffer_encoder.c easy_decoder_memusage.c easy_encoder.c \
 easy_encoder_memusage.c easy_preset.c fastpos_table.c fastpos_tablegen.c \
 filter_buffer_decoder.c filter_buffer_encoder.c filter_common.c \
 filter_decoder.c filter_encoder.c filter_flags_decoder.c \
 filter_flags_encoder.c ia64.c index.c index_decoder.c index_encoder.c \
 index_hash.c lz_decoder.c lz_encoder.c lz_encoder_mf.c lzma2_decoder.c \
 lzma2_encoder.c lzma_decoder.c lzma_encoder.c lzma_encoder_optimum_fast.c \
 lzma_encoder_optimum_normal.c lzma_encoder_presets.c powerpc.c \
 price_table.c price_tablegen.c sha256.c simple_coder.c simple_decoder.c \
 simple_encoder.c sparc.c stream_buffer_decoder.c stream_buffer_encoder.c \
 stream_decoder.c stream_encoder.c stream_flags_common.c \
 stream_flags_decoder.c stream_flags_encoder.c subblock_decoder.c \
 subblock_decoder_helper.c vli_decoder.c vli_encoder.c vli_size.c x86.c

OBJECTS = $(SOURCES:.c=.o)
@WANT_R_SHLIB_TRUE@ALL_CFLAGS = $(ALL_CFLAGS_LO) @C_VISIBILITY@

distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = Makefile.in Makefile.win R_changes
noinst_LIBRARIES = liblzma.a
liblzma_a_SOURCES = $(SOURCES)
liblzma_a_OBJECTS = $(OBJECTS)
SUBDIRS_WITH_NO_BUILD = \
  api check common delta lz lzma rangecoder simple subblock

all: @BUILD_XZ_TRUE@ R

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
	@cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@

R: Makefile @BUILD_XZ_TRUE@ stamp
	@BUILD_XZ_TRUE@ @$(MAKE) $(noinst_LIBRARIES)

stamp:
	@ln -s $(srcdir)/*/*.c $(srcdir)/*/*.h .
	touch stamp

liblzma.a: $(liblzma_a_OBJECTS)
	rm -f $@
	$(AR) cr $@ $(liblzma_a_OBJECTS)
	$(RANLIB) $@

mostlyclean: clean
clean:
	@-rm -f Makedeps stamp *.c *.h *.o *.lo *.a
distclean: clean
	@-rm -f Makefile
maintainer-clean: distclean

install install-strip uninstall TAGS info dvi check:

distdir: $(DISTFILES)
	@for f in $(DISTFILES); do \
	  test -f $(distdir)/$${f} \
	    || ln $(srcdir)/$${f} $(distdir)/$${f} 2>/dev/null \
	    || cp -p $(srcdir)/$${f} $(distdir)/$${f}; \
	done
	@for d in $(SUBDIRS_WITH_NO_BUILD); do \
	  ((cd $(srcdir); $(TAR) -c -f - $(DISTDIR_TAR_EXCLUDE) $${d}) \
	      | (cd $(distdir); $(TAR) -x -f -)) \
	    || exit 1; \
	done

## Automagically generated dependencies:

