--- src/AlgebraicCore/Makefile.orig	2020-03-11 17:00:26 UTC
+++ src/AlgebraicCore/Makefile
@@ -1,10 +1,5 @@
 # Makefile for CoCoALib/src/AlgebraicCore/ directory.
 
-COCOA_ROOT=../..
-include $(COCOA_ROOT)/configuration/autoconf.mk
-CWD=src/AlgebraicCore/
-DEPEND_FILE=Makefile_dependencies
-
 SUBDIRS=TmpFactorDir TmpHilbertDir
 
 FROBBY_FILES=ExternalLibs-Frobby.C
@@ -72,126 +67,17 @@ SRCS=time.C assert.C utils.C  utils-gmp.C  VectorOps.C
      $(FROBBY_FILES) $(GFAN_FILES) $(GSL_FILES) \
      $(MATHSAT_FILES) $(NORMALIZ_FILES)
 
-# (see below) OBJS depend on $(COCOA_ROOT)/configuration/autoconf.mk
-OBJS=$(SRCS:.C=.o)
+all: ${SRCS:.C=.o}
+	for x in ${SUBDIRS}; do make -C $$x; done
+	ar rcs libcocoa.a ${.ALLSRC}
 
-# The default target compiles debug_new.C and leak_checker.C as
-# well as all the files listed in SRCS.
-default:
-	@echo "*** $(CWD)Makefile: default target ***"
-	@cd $(COCOA_ROOT); $(MAKE) library
+.SUFFIXES:.o
 
-.PHONY: all
-all: check-source-files $(COCOA_LIB) debug_new.o leak_checker
+.C.o:
+	${CXX} ${CXXFLAGS} -o ${.TARGET} -c ${.IMPSRC}
 
-$(COCOA_LIB): $(OBJS) $(SUBDIRS)
-	mkdir -p `dirname $(COCOA_LIB)`
-	for subdir in $(SUBDIRS); \
-	do \
-	  echo "Compiling directory $(CWD)$$subdir/"; \
-	  touch "$$subdir"; \
-	  ( cd "$$subdir"; $(MAKE) -s ); \
-	  if [ $$? -ne 0 ]; then echo "***** Compilation of $(CWD)$$subdir/ FAILED *****"; exit 1; fi; \
-	done
-	echo "doing ar for AlgebraicCore"
-	ar $(ARFLAGS) $(COCOA_LIB) $(OBJS)
-
-$(OBJS):  $(COCOA_ROOT)/configuration/autoconf.mk
-
-.PHONY: check-source-files
-check-source-files:
-	@./CheckSourceFiles.sh $(SRCS)
-
-
-#######################################################
-# Special compilation targets with extra CPP symbols.
-BuildInfo.o: BuildInfo.C $(COCOA_ROOT)/include/CoCoA/BuildInfo.H
-	@echo "Compiling BuildInfo.o (with special preprocessor flags)"
-	$(COMPILE) -c  -DCOCOA_VERSION="\"$(COCOALIB_VERSION)\""  -DCOCOA_CXX="\"$(CXX)\""  -DCOCOA_CXXFLAGS="\"$(CXXFLAGS)\""  -DCOCOA_CXXFLAGS_DEFINES="\"$(CXXFLAGS_DEFINES)\""  -o BuildInfo.o BuildInfo.C
-
-IdealOfPoints.o: IdealOfPoints.C $(COCOA_ROOT)/include/CoCoA/IdealOfPoints.H
-	@echo "Compiling IdealOfPoints --  keep your fingers crossed"
-	$(COMPILE) -ITmpFactorDir/ -c IdealOfPoints.C
-
-factor.o: factor.C $(COCOA_ROOT)/include/CoCoA/factor.H
-	@echo "Compiling factor --  keep your fingers crossed"
-	$(COMPILE) -ITmpFactorDir/ -ITmpFactorDir/multivariate/ -c factor.C
-
-TmpHilbert.o: TmpHilbert.C $(COCOA_ROOT)/include/CoCoA/TmpHilbert.H
-	@echo "Compiling TmpHilbert --  keep your fingers crossed"
-	$(COMPILE) -ITmpHilbertDir/ -c TmpHilbert.C
-
-debug_new.o: debug_new.C $(COCOA_ROOT)/include/CoCoA/debug_new.H
-	@echo "Compiling debug_new.o (not part of CoCoALib)"
-	$(COMPILE) -c -o debug_new.o debug_new.C
-
-leak_checker: leak_checker.C
-	@echo "Compiling leak_checker (not part of CoCoALib)"
-	$(COMPILE) -o leak_checker leak_checker.C
-	/bin/rm -rf leak_checker.dSYM
-
-
-.PHONY: clean clean-local clean-subdirs
-clean: clean-local clean-subdirs
-	@echo "Cleaned CoCoALib/$(CWD)"
-
-clean-local:
-	@/bin/rm -f  $(OBJS)  a.out  core  "$(DEPEND_FILE).old"  "$(DEPEND_FILE).new"  leak_checker  debug_new.o
-	@/bin/rm -f  ./*~  ./.*~  ./.\#*
-	@/bin/rm -rf  ./*.dSYM
-
-clean-subdirs:
-	for subdir in $(SUBDIRS); do ( cd $$subdir; $(MAKE) -s clean ); done
-
-.PHONY: veryclean  veryclean-subdirs
-veryclean:  clean-local  veryclean-subdirs
-	@/bin/rm -f "$(DEPEND_FILE)"
-	@true >| "$(DEPEND_FILE)" # Empties $(DEPEND_FILE)
-	@echo "Verycleaned CoCoALib/$(CWD)"
-
-veryclean-subdirs:
-	for subdir in $(SUBDIRS); do ( cd $$subdir; $(MAKE) -s veryclean ); done
-
-
-# This target checks whether we should really build DEPEND_FILE...
-# (only if COCOA_HDR is newer than DEPEND_FILE).
-.PHONY: dependencies
-dependencies:
-	@if [ \! -s "$(DEPEND_FILE)" -o \! "$(DEPEND_FILE)" -nt "$(COCOA_HDR)" ] ; \
-	then \
-	  $(MAKE) create-dependencies; \
-	fi
-	for subdir in $(SUBDIRS); do ( cd $$subdir; $(MAKE) -s dependencies ); done
-
-# This is the target which really does rebuild the DEPEND_FILE
-.PHONY: create-dependencies
-create-dependencies:
-	@/bin/rm -rf $(DEPEND_FILE).new
-	@echo "Rebuilding dependencies in <CoCoALib>/$(CWD)"
-	@echo "##################################################################"   >> $(DEPEND_FILE).new
-	@echo "#        ---  CoCoALib version $(COCOALIB_VERSION)  ---"              >> $(DEPEND_FILE).new
-	@echo "# Dependencies for directory $(CWD)"                                  >> $(DEPEND_FILE).new
-	@echo "# DO NOT EDIT: this file is automatically generated; to regenerate"   >> $(DEPEND_FILE).new
-	@echo "# run \`make dependencies' in the CoCoALib root directory."           >> $(DEPEND_FILE).new
-	@echo "##################################################################"   >> $(DEPEND_FILE).new
-	@echo                                                                        >> $(DEPEND_FILE).new
-	@for srcfile in $(SRCS); \
-	do \
-	  objfile=`basename $$srcfile .C`.o; \
-	  $(CXX) $(CXXFLAGS) $(CXXFLAGS_DEFINES) $(INCLUDE) -ITmpFactorDir -ITmpFactorDir/linalg -ITmpFactorDir/multivariate -MM "$$srcfile" -MQ "$$objfile" >> $(DEPEND_FILE).new; \
-	  echo >> $(DEPEND_FILE).new; \
-	done
-	@if [ -s "$(DEPEND_FILE)" ] ; \
-	then \
-	  /bin/mv -f "$(DEPEND_FILE)" "$(DEPEND_FILE).old" ; \
-	fi
-	@/bin/mv -f $(DEPEND_FILE).new  $(DEPEND_FILE)
-
-
-$(DEPEND_FILE):
-	@touch "$(DEPEND_FILE)"
-
-include $(DEPEND_FILE)
+BuildInfo.o:
+	${CXX} ${CXXFLAGS} -DCOCOA_VERSION="\"%%DISTVERSION%%\"" -DCOCOA_CXX="\"${CXX}\"" -DCOCOA_CXXFLAGS="\"${CXXFLAGS}\"" -DCOCOA_CXXFLAGS_DEFINES="\"\"" -o BuildInfo.o -c BuildInfo.C
 
 # Next few lines are for RCS header/log
 # $Header: /Volumes/Home_1/cocoa/cvs-repository/CoCoALib-0.99/src/AlgebraicCore/Makefile,v 1.169 2020/03/11 17:00:26 abbott Exp $
