shithub: mc

Download patch

ref: 2f89a7c19f30730d3c6719bd497d6017fa6fbb61
parent: 6476ae94e37b0a07578973bfc1615088dd62f0bf
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Mar 9 06:12:58 EDT 2015

More makefile cleanups.

    Separate stuff into GENSRC, and copy things
    correctly.

--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -1,21 +1,31 @@
-SYSLIB=sys
-SYSSRC= \
+.SUFFIXES:
+GENSRC= \
 	dial.myr \
 	dir.myr \
 	env.myr \
 	ifreq.myr \
 	resolve.myr \
-	syserrno.myr \
 	sys.myr \
+	syscall.s \
+	syserrno.myr \
 	syswrap.myr \
 	syswrap-ss.myr \
+	util.s \
 	wait.myr \
 
+SYSLIB=sys
+SYSSRC= \
+	sys.myr \
+        syscall.s \
+        syserrno.myr \
+        systypes.myr \
+        ifreq.myr \
+        util.s \
+
 SYSASMSRC= \
 	syscall.s \
 	util.s
 
-
 STDLIB=std
 STDSRC= \
 	alloc.myr \
@@ -26,9 +36,12 @@
 	chartype.myr \
 	cmp.myr \
 	clear.myr \
+	dial.myr \
 	die.myr \
+	dir.myr \
 	dirname.myr \
 	endian.myr \
+	env.myr \
 	errno.myr \
 	execvp.myr \
 	extremum.myr \
@@ -50,6 +63,7 @@
 	pathjoin.myr \
 	putint.myr \
 	rand.myr \
+	resolve.myr \
 	result.myr \
 	search.myr \
 	slcp.myr \
@@ -67,6 +81,8 @@
 	strjoin.myr \
 	strsplit.myr \
 	strstrip.myr \
+	syswrap.myr \
+	syswrap-ss.myr \
 	swap.myr \
 	try.myr \
 	types.myr \
@@ -73,11 +89,13 @@
 	units.myr \
 	utf.myr \
 	varargs.myr \
+	wait.myr \
 
 include ../config.mk
 
 all: lib$(STDLIB).a $(MYRBIN)
 
+
 # HACK HACK HACK.
 # Ideally we would have patterns for the
 # foo+arch-suffix.myr instead of a loop,
@@ -85,7 +103,8 @@
 # of patterns that Make will try, leading to
 # millions of files getting statted. This
 # works around that.
-COPYTARG = for suff in $(SYSCLASS)-$(SYS)-$(ARCH) \
+COPYTARG = for targ in \
+	   	$(SYSCLASS)-$(SYS)-$(ARCH) \
 		$(SYSCLASS)-$(SYS) \
 		$(SYSCLASS)-$(ARCH) \
 		$(SYSCLASS) \
@@ -92,19 +111,20 @@
 		$(SYS)-$(ARCH) \
 		$(SYS) \
 		$(ARCH); do \
-	    if [ -f $*+$$targ.$$ext ] ; then  \
+		echo "trying $*+$$targ.$$ext"; \
+		if [ -f $*+$$targ.$$ext ] ; then  \
 		echo $$targ; \
 		echo cp $*+$$targ.$$ext $@; \
 		cp $*+$$targ.$$ext $@; \
 		exit 0; \
-	    fi; \
+	fi; \
 	done; \
 
-%.myr: %+*.myr
+%.myr:
 	@export ext=myr; \
 	$(COPYTARG)
 
-%.s: %+*.s
+%.s:
 	@export ext=s; \
 	$(COPYTARG)
 
@@ -124,7 +144,7 @@
 clean:
 	rm -f $(OBJ)
 	rm -f $(USE)
-	rm -f $(SYSSRC)
+	rm -f $(GENSRC)
 	rm -f lib$(STDLIB).a lib$(SYSLIB).a
 
 install: all