From be0e05916c0d308c01628885c8e03b32a5d2359b Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <vital.had@gmail.com>
Date: Fri, 28 Oct 2022 22:05:16 +0800
Subject: [PATCH 8/8] Makefile: fix gcc targets

---
 Makefile | 80 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/Makefile b/Makefile
index d4d8573..ffe8743 100644
--- a/Makefile
+++ b/Makefile
@@ -158,14 +158,14 @@ MAN = man/*.1
 
 TARGDIR= targets
 TARGETS= runtime prelude libraries greencard hp2graph hsc2hs cpphs cabal-parse \
-	 profruntime profprelude profprelude-$(CC) \
-	 timeruntime timeprelude timeprelude-$(CC) \
-	 proflibraries timelibraries proflibraries-$(CC) timelibraries-$(CC) \
-	 compiler-nhc compiler-hbc compiler-ghc compiler-$(CC) \
-	 hmake-nhc hmake-hbc hmake-ghc hmake-$(CC) \
-	 greencard-nhc greencard-hbc greencard-ghc greencard-$(CC) \
-	 prelude-$(CC) pragma-$(CC) libraries-$(CC) hsc2hs-$(CC) cpphs-$(CC) \
-	 cabal-parse-$(CC)
+	 profruntime profprelude profprelude-gcc \
+	 timeruntime timeprelude timeprelude-gcc \
+	 proflibraries timelibraries proflibraries-gcc timelibraries-gcc \
+	 compiler-nhc compiler-hbc compiler-ghc compiler-gcc \
+	 hmake-nhc hmake-hbc hmake-ghc hmake-gcc \
+	 greencard-nhc greencard-hbc greencard-ghc greencard-gcc \
+	 prelude-gcc pragma-gcc libraries-gcc hsc2hs-gcc cpphs-gcc \
+	 cabal-parse-gcc
 
 .PHONY: default basic all compiler help config install
 
@@ -193,9 +193,9 @@ help:
 	@echo "    $(PACKAGES)"
 
 config: script/errnogen.c
-	if [ "$(MACHINE)" != "" ]; then CC=$(CC) ./configure --target=$(MACHINE) --config ; else ./configure --config ; fi
+	if [ "$(MACHINE)" != "" ]; then CC=@CC@ ./configure --target=$(MACHINE) --config ; else ./configure --config ; fi
 install:
-	if [ "$(MACHINE)" != "" ]; then CC=$(CC) ./configure --target=$(MACHINE) --install ; else ./configure --config ; fi
+	if [ "$(MACHINE)" != "" ]; then CC=@CC@ ./configure --target=$(MACHINE) --install ; else ./configure --config ; fi
 	
 test:
 	cd tests && ./runtests clean >/dev/null && ./runtests >t.log 2>t.err
@@ -207,9 +207,9 @@ basic-hbc: $(PRAGMA) runtime hmake-hbc greencard-hbc compiler-hbc cpphs \
 						prelude hsc2hs libraries
 basic-ghc: $(PRAGMA) runtime hmake-ghc greencard-ghc compiler-ghc cpphs \
 						prelude hsc2hs libraries
-basic-$(CC): runtime prelude-$(CC) pragma-$(CC) cpphs-$(CC) \
-		greencard-$(CC) hmake-$(CC) hsc2hs-$(CC) package-deps-$(CC) \
-		compiler-$(CC) libraries-$(CC)
+basic-gcc: runtime prelude-gcc pragma-gcc cpphs-gcc \
+		greencard-gcc hmake-gcc hsc2hs-gcc package-deps-gcc \
+		compiler-gcc libraries-gcc
 
 all-$(BUILDCOMP): basic-$(BUILDCOMP) heapprofile timeprofile #hoodui
 
@@ -302,7 +302,7 @@ $(TARGDIR)/$(MACHINE)/cabal-parse: polyparse src/libraries/cabal-parse2.hs \
 		-Isrc/libraries -package polyparse -package base
 	touch $@
 
-$(TARGDIR)/$(MACHINE)/cabal-parse-$(CC): $(LIBRARIESC)
+$(TARGDIR)/$(MACHINE)/cabal-parse-gcc: $(LIBRARIESC)
 	script/nhc98 -o $(LIBDIR)/$(MACHINE)/cabal-parse \
 		src/libraries/CabalParse2.hc src/libraries/cabal-parse2.hc \
 		-Isrc/libraries -package polyparse -package base
@@ -366,73 +366,73 @@ $(TARGDIR)/$(MACHINE)/timelibraries: $(LIBRARIES)
 	done && touch $(TARGDIR)/$(MACHINE)/timelibraries
 
 
-$(TARGDIR)/$(MACHINE)/prelude-$(CC): $(PRELUDEC)
+$(TARGDIR)/$(MACHINE)/prelude-gcc: $(PRELUDEC)
 	cd src/prelude;        $(MAKE) fromC relink
-	touch $(TARGDIR)/$(MACHINE)/prelude-$(CC)
+	touch $(TARGDIR)/$(MACHINE)/prelude-gcc
 	touch $(TARGDIR)/$(MACHINE)/prelude
-$(TARGDIR)/$(MACHINE)/timeprelude-$(CC): $(PRELUDEC)
+$(TARGDIR)/$(MACHINE)/timeprelude-gcc: $(PRELUDEC)
 	cd src/prelude;        $(MAKE) CFG=z fromC
 	cd src/prelude/$(MACHINE)/NHC; $(MAKE) CFG=z clean all
 	cd src/prelude;        $(MAKE) CFG=z relink
-	touch $(TARGDIR)/$(MACHINE)/timeprelude-$(CC)
+	touch $(TARGDIR)/$(MACHINE)/timeprelude-gcc
 	touch $(TARGDIR)/$(MACHINE)/timeprelude
-$(TARGDIR)/$(MACHINE)/profprelude-$(CC): $(PRELUDEC)
+$(TARGDIR)/$(MACHINE)/profprelude-gcc: $(PRELUDEC)
 	cd src/prelude;        $(MAKE) CFG=p fromC
 	cd src/prelude/$(MACHINE)/NHC; $(MAKE) CFG=p clean all
 	cd src/prelude;        $(MAKE) CFG=p relink
-	touch $(TARGDIR)/$(MACHINE)/profprelude-$(CC)
+	touch $(TARGDIR)/$(MACHINE)/profprelude-gcc
 	touch $(TARGDIR)/$(MACHINE)/profprelude
-$(TARGDIR)/$(MACHINE)/compiler-$(CC): $(COMPILERC)
+$(TARGDIR)/$(MACHINE)/compiler-gcc: $(COMPILERC)
 	cd src/compiler98;     $(MAKE) fromC
 	cd src/prelude/$(MACHINE)/NHC; $(MAKE) clean all	# Patch machine-specific parts.
 	cd src/prelude;        $(MAKE) relink
 	cd src/compiler98;     $(MAKE) relink
-	touch $(TARGDIR)/$(MACHINE)/compiler-$(CC)
-$(TARGDIR)/$(MACHINE)/greencard-$(CC): $(GREENCARDC)
+	touch $(TARGDIR)/$(MACHINE)/compiler-gcc
+$(TARGDIR)/$(MACHINE)/greencard-gcc: $(GREENCARDC)
 	cd src/greencard;      $(MAKE) fromC
-	touch $(TARGDIR)/$(MACHINE)/greencard $(TARGDIR)/$(MACHINE)/greencard-$(CC)
-$(TARGDIR)/$(MACHINE)/pragma-$(CC): script/hmake-PRAGMA.hc
+	touch $(TARGDIR)/$(MACHINE)/greencard $(TARGDIR)/$(MACHINE)/greencard-gcc
+$(TARGDIR)/$(MACHINE)/pragma-gcc: script/hmake-PRAGMA.hc
 	script/nhc98 -o $(PRAGMA) script/hmake-PRAGMA.hc
-	touch $(TARGDIR)/$(MACHINE)/pragma-$(CC)
-$(TARGDIR)/$(MACHINE)/cpphs-$(CC): $(CPPHS)
+	touch $(TARGDIR)/$(MACHINE)/pragma-gcc
+$(TARGDIR)/$(MACHINE)/cpphs-gcc: $(CPPHS)
 	cd src/cpphs;          $(MAKE) -f Makefile.nhc98 fromC
-	touch $(TARGDIR)/$(MACHINE)/cpphs-$(CC)
-$(TARGDIR)/$(MACHINE)/hmake-$(CC): $(HMAKEC)
+	touch $(TARGDIR)/$(MACHINE)/cpphs-gcc
+$(TARGDIR)/$(MACHINE)/hmake-gcc: $(HMAKEC)
 	cd src/hmake;          $(MAKE) BUILDCOMP=nhc fromC config
 	cd src/interpreter;    $(MAKE) BUILDCOMP=nhc fromC
-	touch $(TARGDIR)/$(MACHINE)/hmake-$(CC)
-$(TARGDIR)/$(MACHINE)/hsc2hs-$(CC): $(HSC2HS) $(HSC2HSC)
+	touch $(TARGDIR)/$(MACHINE)/hmake-gcc
+$(TARGDIR)/$(MACHINE)/hsc2hs-gcc: $(HSC2HS) $(HSC2HSC)
 	cd src/hsc2hs;         $(MAKE) -f Makefile.nhc98 fromC
-	touch $(TARGDIR)/$(MACHINE)/hsc2hs-$(CC)
-package-deps-$(CC):
+	touch $(TARGDIR)/$(MACHINE)/hsc2hs-gcc
+package-deps-gcc:
 	( cd src/libraries/base; $(MAKE) -f Makefile.nhc98 fromC; ) && \
 	( cd src/libraries/polyparse; $(MAKE) -f Makefile.nhc98 fromC; ) && \
-	$(MAKE) cabal-parse-$(CC) && \
+	$(MAKE) cabal-parse-gcc && \
 	for pkg in array filepath packedstring containers;\
 	do ( cd src/libraries/$$pkg; $(MAKE) -f ../Makefile.cabal fromC; ) ;\
 	done
-$(TARGDIR)/$(MACHINE)/libraries-$(CC): $(LIBRARIES)
+$(TARGDIR)/$(MACHINE)/libraries-gcc: $(LIBRARIES)
 	for pkg in ${PACKAGEBUILD};\
 	do ( cd src/libraries/$$pkg; $(MAKE) -f Makefile.nhc98 fromC; ) ;\
 	done && \
 	$(MAKE) cabal-parse && \
 	for pkg in ${PACKAGECABAL};\
 	do ( cd src/libraries/$$pkg; $(MAKE) -f ../Makefile.cabal fromC; ) ;\
-	done && touch $(TARGDIR)/$(MACHINE)/libraries-$(CC)
-$(TARGDIR)/$(MACHINE)/proflibraries-$(CC): $(LIBRARIES)
+	done && touch $(TARGDIR)/$(MACHINE)/libraries-gcc
+$(TARGDIR)/$(MACHINE)/proflibraries-gcc: $(LIBRARIES)
 	for pkg in ${PACKAGEBUILD};\
 	do ( cd src/libraries/$$pkg; $(MAKE) -f Makefile.nhc98 CFG=p fromC; ) ;\
 	done && \
 	for pkg in ${PACKAGECABAL};\
 	do ( cd src/libraries/$$pkg; $(MAKE) -f ../Makefile.cabal CFG=p fromC; ) ;\
-	done && touch $(TARGDIR)/$(MACHINE)/proflibraries-$(CC)
-$(TARGDIR)/$(MACHINE)/timelibraries-$(CC): $(LIBRARIES)
+	done && touch $(TARGDIR)/$(MACHINE)/proflibraries-gcc
+$(TARGDIR)/$(MACHINE)/timelibraries-gcc: $(LIBRARIES)
 	for pkg in ${PACKAGEBUILD};\
 	do ( cd src/libraries/$$pkg; $(MAKE) -f Makefile.nhc98 CFG=z fromC; ) ;\
 	done && \
 	for pkg in ${PACKAGECABAL};\
 	do ( cd src/libraries/$$pkg; $(MAKE) -f ../Makefile.cabal CFG=z fromC; ) ;\
-	done && touch $(TARGDIR)/$(MACHINE)/timelibraries-$(CC)
+	done && touch $(TARGDIR)/$(MACHINE)/timelibraries-gcc
 
 
 script/errnogen.c: script/GenerateErrNo.hs
-- 
2.36.1

