# wrapper makefile for taglib
include $(shell while [ "`pwd`" != / -a \! -r options.mk ]; do cd .. ; done ; pwd )/options.mk

MODULE := libltdl

MODULE_VERSION := 1.2

INSTALL := $(ROOT_MODULES_DIR)/$(MODULE)
INSTALL_LIBDIR:=$(INSTALL)/usr/lib
INSTALL_INCDIR:=$(INSTALL)/usr/include
BOM := $(CURDIR)/BOM

BUILDRESULTS := $(CURDIR)/buildresults
GPLRESULTS := $(CURDIR)/gplresults

HEADERS:= ltdl.h
SOURCES:= ltdl.c

$(MODULE).so: $(SOURCES) $(HEADERS)
	$(CC) $(CFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H $(LDFLAGS) -Wl,-soname,libltdl -c $(SOURCES) -fPIC -shared -o $@ -Wl,-as-needed -Wl,-ldl -ldl

build: $(MODULE).so

configure: 

clean-install:
	$(call RM, $(INSTALL))

install: build
	$(call MKDIR, $(INSTALL_INCDIR) $(INSTALL_LIBDIR))
	$(call COPY, $(MODULE).so, $(INSTALL_LIBDIR))
	$(call COPY, $(HEADERS), $(INSTALL_INCDIR))

buildresults: install

clean: clean-install
	$(call RM,$(MODULE).*o)
	$(call RM,ltdl.*o)

distclean: clean
	-$(call RM,$(ROOT_STAGING_INCDIR)/*ltdl* $(ROOT_STAGING_LIBDIR)/*ltdl*) 

gplresults: distclean
	$(call RM,$(GPLRESULTS))
	$(call MKDIR,$(GPLRESULTS))
	tar cjvf $(GPLRESULTS)/$(MODULE)-$(MODULE_VERSION).tar.bz2 . $(GPL_TAR_OPTIONS)
	@echo gplresults tree is in $(GPLRESULTS)
	
all: distclean configure build install buildresults


.PHONY: build configure clean-install install buildresults clean distclean gplresults all

