shithub: mc

Download patch

ref: 96c8b599027a762ccaf6bd5c7633e3ede3850153
parent: e898ab8413e852b6f097e047157093014246c9a2
author: Ori Bernstein <[email protected]>
date: Fri Oct 3 13:28:59 EDT 2014

Strip out platform suffixes from compiler output.

    foo+platformstrig.myr will compile to foo.o for now.

--- a/6/main.c
+++ b/6/main.c
@@ -44,15 +44,20 @@
     printf("\t-S\tGenerate assembly instead of object code\n");
 }
 
-static void assem(char *asmsrc, char *input)
+static void assem(char *asmsrc, char *path)
 {
     char *asmcmd[] = Asmcmd;
     char objfile[1024];
+    char *psuffix;
     char **p, **cmd;
     size_t ncmd;
     int pid, status;
 
-    swapsuffix(objfile, 1024, input, ".myr", ".o");
+    psuffix = strrchr(path, '+');
+    if (psuffix != NULL)
+        swapsuffix(objfile, 1024, path, psuffix, ".o");
+    else
+        swapsuffix(objfile, 1024, path, ".myr", ".o");
     cmd = NULL;
     ncmd = 0;
     for (p = asmcmd; *p != NULL; p++)
@@ -97,8 +102,13 @@
 {
     FILE *f;
     char buf[1024];
+    char *psuffix;
 
-    swapsuffix(buf, sizeof buf, path, ".myr", ".use");
+    psuffix = strrchr(path, '+');
+    if (psuffix != NULL)
+        swapsuffix(buf, 1024, path, psuffix, ".use");
+    else
+        swapsuffix(buf, 1024, path, ".myr", ".use");
     f = fopen(buf, "w");
     if (!f)
         err(1, "Could not open path %s\n", buf);
--- /dev/null
+++ b/libstd/bldfile
@@ -1,0 +1,72 @@
+lib std =
+	# portable files
+	alloc.myr
+	bigint.myr
+	bitset.myr
+	blat.myr
+	chartype.myr
+	cmp.myr
+	dial.myr
+	die.myr
+	endian.myr
+	env.myr
+	execvp.myr
+	extremum.myr
+	fltbits.myr
+	fltfmt.myr
+	fmt.myr
+	hashfuncs.myr
+	hasprefix.myr
+	hassuffix.myr
+	htab.myr
+	intparse.myr
+	ipparse.myr
+	mk.myr
+	now.myr
+	option.myr
+	optparse.myr
+	pathjoin.myr
+	rand.myr
+	resolve.myr
+	result.myr
+	search.myr
+	slcp.myr
+	sldup.myr
+	sleq.myr
+	slfill.myr
+	sljoin.myr
+	slpush.myr
+	slput.myr
+	slurp.myr
+	sort.myr
+	spork.myr
+	strfind.myr
+	strjoin.myr
+	strsplit.myr
+	strstrip.myr
+	swap.myr
+	test.myr
+	try.myr
+	types.myr
+	units.myr
+	utf.myr
+	util.s
+	varargs.myr
+
+	# platform specific files
+	dir+freebsd.myr
+	dir+linux.myr
+	dir+osx.myr
+	ifreq+freebsd.myr
+	ifreq+linux.myr
+	ifreq+osx.myr
+	syscall+freebsd.s
+	syscall+linux.s
+	syscall+osx.s
+	sys+freebsd.myr
+	sys+linux.myr
+	sys+osx.myr
+	waitstatus+freebsd.myr
+	waitstatus+linux.myr
+	waitstatus+osx.myr
+;;