# for variables passed from parent makefile see ../SOURCE_TOOLS/parent_make.txt

.SUFFIXES: .o .cxx .depend

CPP_OBJECTS = $(subst .cxx,.o,$(wildcard *.cxx))

cma_cxxflags:=$(cxxflags)
cma_cflags:= $(cflags)

SUPPRESS_WARNINGS=1# set to 0 to show warnings

ifeq ($(SUPPRESS_WARNINGS),1)
 cma_cxxflags:= $(subst -Weffc++,,$(cma_cxxflags))
 cma_cxxflags:= $(subst -Wctor-dtor-privacy,,$(cma_cxxflags))
 cma_cxxflags:= $(subst -Wlogical-op,,$(cma_cxxflags))
 cma_cxxflags:= $(subst -Wunused-local-typedefs,,$(cma_cxxflags))
 cma_cxxflags:= $(cma_cxxflags) -Wno-deprecated-declarations -Wno-ignored-attributes -Wno-int-in-bool-context -Wno-zero-as-null-pointer-constant -Wno-deprecated-copy
 cma_cflags:= $(subst -Wshadow,,$(cma_cflags))
 ifeq ($(USE_CLANG),1)
# clang spams warnings about unused parameters in Eigen (-> skip them)
  cma_cxxflags+= -Wno-unused-parameter -Wno-unused-variable
 else
# -Wunused-local-typedefs is included in -Wall -> disable (not for clang)
  cma_cflags+= -Wno-unused-local-typedefs
 endif
endif

cma_cflags+= -I../HEADERLIBS

$(MAIN): $(CPP_OBJECTS) warn
	@$(ARBHOME)/SOURCE_TOOLS/binuptodate.pl $(MAIN) $(CPP_OBJECTS) || ( \
		echo "$(LINK_STATIC_LIB) $(MAIN) $(CPP_OBJECTS)"; \
		$(LINK_STATIC_LIB) $(MAIN) $(CPP_OBJECTS) ; \
	)

warn:
ifeq ($(SUPPRESS_WARNINGS),1)
	@echo "------------------------------------------------------------------------------------------"
	@echo "Please note: Several compiler warnings have been disabled in RNACMA"
	@echo "(namely -Weffc++, -Wctor-dtor-privacy, -Wlogical-op, -Wshadow, -Wunused-local-typedefs,"
	@echo "        -Wint-in-bool-context, -Wdeprecated-declarations, -Wignored-attributes,"
	@echo "        -Wzero-as-null-pointer-constant -Wdeprecated-copy)"
	@echo "to avoid Eigen spams us with warnings here."
	@echo "------------------------------------------------------------------------------------------"
endif

.cxx.o: warn Makefile
	$(A_CXX) $(cma_cflags) $(cma_cxxflags) -c $<  $(CXX_INCLUDES)  $(POST_COMPILE) $<


$(CPP_OBJECTS) : Makefile

clean:
	rm -f $(CPP_OBJECTS) *.a

DEPENDS = $(CPP_OBJECTS:.o=.depend)
depends: $(DEPENDS)
	@cat $(DEPENDS) | grep -v '^#' >>Makefile
	@rm $(DEPENDS)
$(DEPENDS): depend.init
depend.init:
	$(MAKEDEPEND) $(MAKEDEPENDFLAGS) 2>/dev/null # remove dependencies
.c.depend:
	$(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) $< 2>/dev/null >$@
.cxx.depend:
	$(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) $< 2>/dev/null >$@

# DO NOT DELETE THIS LINE -- make depend depends on it.

# Do not add dependencies manually - use 'make depend' in $ARBHOME
# For formatting issues see SOURCE_TOOLS/fix_depends.pl (from main)

AlignedSequenceLoader.o: AlignedSequenceLoader.h
AlignedSequenceLoader.o: Cma.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/ad_prot.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/ad_t_prot.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arb_assert.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arb_core.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arb_error.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arb_mem.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arb_msg.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arb_string.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arbdb.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arbdb_base.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arbdbt.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/arbtools.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/attributes.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/cxxforward.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/downcast.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/dupstr.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/gccver.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/smartptr.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/static_assert.h
AlignedSequenceLoader.o: $(ARBHOME)/INCLUDE/test_global.h

Analyser.o: AlignedSequenceLoader.h
Analyser.o: Analyser.h
Analyser.o: Cma.h
Analyser.o: $(ARBHOME)/INCLUDE/ad_prot.h
Analyser.o: $(ARBHOME)/INCLUDE/ad_t_prot.h
Analyser.o: $(ARBHOME)/INCLUDE/arb_assert.h
Analyser.o: $(ARBHOME)/INCLUDE/arb_core.h
Analyser.o: $(ARBHOME)/INCLUDE/arb_error.h
Analyser.o: $(ARBHOME)/INCLUDE/arb_mem.h
Analyser.o: $(ARBHOME)/INCLUDE/arb_msg.h
Analyser.o: $(ARBHOME)/INCLUDE/arb_string.h
Analyser.o: $(ARBHOME)/INCLUDE/arbdb.h
Analyser.o: $(ARBHOME)/INCLUDE/arbdb_base.h
Analyser.o: $(ARBHOME)/INCLUDE/arbdbt.h
Analyser.o: $(ARBHOME)/INCLUDE/arbtools.h
Analyser.o: $(ARBHOME)/INCLUDE/attributes.h
Analyser.o: $(ARBHOME)/INCLUDE/cxxforward.h
Analyser.o: $(ARBHOME)/INCLUDE/downcast.h
Analyser.o: $(ARBHOME)/INCLUDE/dupstr.h
Analyser.o: $(ARBHOME)/INCLUDE/gccver.h
Analyser.o: $(ARBHOME)/INCLUDE/smartptr.h
Analyser.o: $(ARBHOME)/INCLUDE/static_assert.h
Analyser.o: $(ARBHOME)/INCLUDE/test_global.h
Analyser.o: $(ARBHOME)/INCLUDE/test_unit.h

Cma.o: Cma.h
Cma.o: $(ARBHOME)/INCLUDE/cxxforward.h
Cma.o: $(ARBHOME)/INCLUDE/gccver.h