#
# make compatibility
#
SHELL = /bin/sh

.SUFFIXES:
.SUFFIXES: .c .cc .cpp .o .d
# 
# Source and Installation Paths
#
prefix  =      @prefix@
exec_prefix =  @exec_prefix@
srcdir =       @srcdir@
datadir  =     @datadir@
VPATH =        @srcdir@
#
# Installation directories for binaries and manual pages
#
bindir  =      @bindir@
mandir  =      @mandir@
man1dir =      $(mandir)/man1
#
# install program
#
INSTALL =               @INSTALL@
INSTALL_PROGRAM =       ${INSTALL}
INSTALL_DATA =          ${INSTALL} -m 644
#
# Program version
#
VERSION = @cdrdao_version@
#
# Data files
#
PIXMAPS_DIR = $(datadir)/pixmaps/gcdmaster
#
# compiler and library stuff
#
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@ 
ALL_CXXFLAGS = @DEFS@ @mydefs@ -DVERSION=\"$(VERSION)\" -I.. -I$(srcdir) -I$(srcdir)/../dao -I$(srcdir)/../trackdb $(CXXFLAGS) @GNOMEMM_CFLAGS@ @GTKMM_CFLAGS@ @GNOME_CFLAGS@
LDFLAGS = @LDFLAGS@ 
LIBS =  @scsilib_libs@ @GNOMEMM_LIBS@ @GTKMM_LIBS@ @GNOME_LIBS@ @thread_libs@ @LIBS@ 
RANLIB = @RANLIB@
AR = ar
#
#
#
SRC = xcdrdao.cc SampleDisplay.cc SampleManager.cc \
      TrackManager.cc AddSilenceDialog.cc TrackInfoDialog.cc TocEdit.cc \
      TextEdit.cc TocInfoDialog.cc guiUpdate.cc TrackDataScrap.cc \
      AddFileDialog.cc CdDevice.cc DeviceConfDialog.cc \
      ProcessMonitor.cc ProgressDialog.cc Settings.cc MessageBox.cc \
      MDIWindow.cc AudioCDProject.cc \
      AudioCDChild.cc RecordGenericDialog.cc RecordCDTarget.cc \
      DeviceList.cc RecordTocSource.cc RecordCDSource.cc \
      RecordHDTarget.cc AudioCDView.cc TocEditView.cc GenericChild.cc \
      GenericView.cc CdTextDialog.cc \
      gcdmaster.cc Project.cc ProjectChooser.cc ViewSwitcher.cc \
      @sound_if_src@

OBJ = $(SRC:%.cc=%.o)

DEP = $(SRC:%.cc=%.d)

PRG = gcdmaster
#
#
#
all: $(PRG)

install: all installdirs
	$(INSTALL_PROGRAM) $(PRG) $(bindir)
	$(INSTALL_DATA) xcdrdao.man $(man1dir)/xcdrdao.1
	$(INSTALL_DATA) gcdmaster.png $(PIXMAPS_DIR)/gcdmaster.png
	$(INSTALL_DATA) pixmap_audiocd.png $(PIXMAPS_DIR)/pixmap_audiocd.png
	$(INSTALL_DATA) pixmap_copycd.png $(PIXMAPS_DIR)/pixmap_copycd.png
	$(INSTALL_DATA) pixmap_datacd.png $(PIXMAPS_DIR)/pixmap_datacd.png
	$(INSTALL_DATA) pixmap_dumpcd.png $(PIXMAPS_DIR)/pixmap_dumpcd.png
	$(INSTALL_DATA) pixmap_help.png $(PIXMAPS_DIR)/pixmap_help.png
	$(INSTALL_DATA) pixmap_mixedcd.png $(PIXMAPS_DIR)/pixmap_mixedcd.png
	$(INSTALL_DATA) pixmap_open.png $(PIXMAPS_DIR)/pixmap_open.png
	$(INSTALL_DATA) gcdmaster.desktop $(datadir)/gnome/apps/Applications/gcdmaster.desktop

installdirs:
	$(srcdir)/../mkinstalldirs $(bindir)
	$(srcdir)/../mkinstalldirs $(man1dir)
	$(srcdir)/../mkinstalldirs $(PIXMAPS_DIR)
	$(srcdir)/../mkinstalldirs $(datadir)/gnome/apps/Applications

uninstall:
	rm -f $(bindir)/$(PRG) $(man1dir)/xcdrdao.1
	rm -f $(PIXMAPS_DIR)/gcdmaster.png $(PIXMAPS_DIR)/pixmap_audiocd.png
	rm -f $(PIXMAPS_DIR)/pixmap_copycd.png $(PIXMAPS_DIR)/pixmap_datacd.png
	rm -f $(PIXMAPS_DIR)/pixmap_dumpcd.png $(PIXMAPS_DIR)/pixmap_help.png
	rm -f $(PIXMAPS_DIR)/pixmap_mixedcd.png $(PIXMAPS_DIR)/pixmap_open.png
	rm -f $(datadir)/gnome/apps/Applications/gcdmaster.desktop

clean:
	rm -f *.o $(PRG)

distclean: clean
	rm -f Makefile
	rm -f *.d
#
#
#
$(PRG): $(OBJ) ../trackdb/libtrackdb.a ../dao/libdao.a
	$(CXX) $(LDFLAGS) -o $(PRG) $(OBJ) -L../dao -ldao -L../trackdb -ltrackdb -L../edc_ecc -ledc_ecc -L../paranoia -lcdda_paranoia $(LIBS)

%.o : %.cc
	$(CXX) $(ALL_CXXFLAGS) -c $< -o $@

%.d : %.cc
	@echo Creating dependencies for $<
	@$(CXX) -M $(ALL_CXXFLAGS) -c $< > $@

#
#
#

include $(DEP)
