########################################
#
# lib-widget-extra Makefile
#
# Dominic Mazzoni, Richard Ash
#
# Run configure to generate Makefile
# from Makefile.in
#

CC = @CC@
CXX = @CXX@
INSTALL = @INSTALL@
LIBS = @LIBS@

srcdir=@srcdir@
top_srcdir=@top_srcdir@
top_builddir=@top_builddir@
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
libdir=@libdir@

# CFLAGS are specific to C.
override CFLAGS += @CFLAGS@

# CXXFLAGS are specific to C++.
override CXXFLAGS += @CXXFLAGS@

# CPPFLAGS are for both C and C++.
override CPPFLAGS += -fno-strict-aliasing @CPPFLAGS@ 

# LDFLAGS are for linking
override LDFLAGS += @LDFLAGS@

# name of the output library file
LIBFILE = libwidgetextra.a
# other generated files
EXTRAS = libwidgetextra.pc libwidgetextra-uninstalled.pc

########################################
# ALL OBJECT FILES

OBJS = NonGuiThread.o

########################################
# Public headers, i.e. ones that get installed on the system

HEADERS = NonGuiThread.h

########################################
# DEPENDENCIES

SOURCES = $(OBJS:%.o=%.cpp)

########################################

.PHONY: all
all: $(LIBFILE) 

.PHONY: install
install: $(LIBFILE) $(HEADERS)
	# install the library file
	$(INSTALL) -d $(DESTDIR)$(LIBDIR)
	$(INSTALL) -m 644 $(LIBFILE) $(DESTDIR)$(LIBDIR)/$(LIBFILE)
	# install the header files

libwidgetextra.a: $(OBJS)
	ar rcs $@ $(OBJS)

#
# You can optionally "make dep" to make dependencies.
# The sed script turns "Foo.o: bar/Foo.cpp" into "bar/Foo.o: bar/Foo.cpp".
#

dep:
	$(CXX) -MM $(CXXFLAGS) $(CPPFLAGS) $(SOURCES) | \
		sed -e 's/^.*\.o: \([^ ]*\)\.cpp/\1.o: \1.cpp/' \
		> .depend

clean:
	rm -rf $(OBJS)
	rm -f $(LIBFILE) $(EXTRAS)

distclean: clean
	rm -f config.log config.status Makefile

#
# Rule for compiling C++ files
#

$(OBJS): %.o: $(srcdir)/%.cpp
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@

#
# Include ".depend" if it exists (run "make dep" to generate it)
#

ifeq (.depend,$(wildcard .depend))
include .depend
endif

