shithub: rgbds

Download patch

ref: 755572c1115c9c419441625dee5dd5e38701e9df
parent: b223905e67e323771c798d33a0641193da58e26f
author: bentley <[email protected]>
date: Fri Jan 15 05:52:38 EST 2010

replace linkfile functionality with command-line options

Instead of running:
$ xlink linkfile.txt
where the linkfile looks like:
---
[Objects]
foo.o
bar.o

[Libraries]
foo.l
bar.l

[Output]
baz.gb
---
we now do:
$ xlink -o baz.gb -l foo.l -l bar.l foo.o bar.o

--- a/src/link/main.c
+++ b/src/link/main.c
@@ -118,13 +118,14 @@
 	int ch;
 	char *ep;
 
-	SLONG argn = 0;
-
 	if (argc == 1)
 		usage();
 
-	while ((ch = getopt(argc, argv, "m:n:s:t:z:")) != -1) {
+	while ((ch = getopt(argc, argv, "l:m:n:o:s:t:z:")) != -1) {
 		switch (ch) {
+		case 'l':
+			lib_Readfile(optarg);
+			break;
 		case 'm':
 			SetMapfileName(optarg);
 			break;
@@ -131,6 +132,9 @@
 		case 'n':
 			SetSymfileName(optarg);
 			break;
+		case 'o':
+			out_Setname(optarg);
+			break;
 		case 's':
 			options |= OPT_SMART_C_LINK;
 			strcpy(smartlinkstartsymbol, optarg);
@@ -171,16 +175,18 @@
 	argc -= optind;
 	argv += optind;
 
-	if (argc == 1) {
-		ProcessLinkfile(argv[argc - 1]);
-		AddNeededModules();
-		AssignSections();
-		CreateSymbolTable();
-		Patch();
-		Output();
-		CloseMapfile();
-	} else
+	if (argc == 0)
 		usage();
+
+	for (int i = 0; i < argc; ++i)
+		obj_Readfile(argv[i]);
+
+	AddNeededModules();
+	AssignSections();
+	CreateSymbolTable();
+	Patch();
+	Output();
+	CloseMapfile();
 
 	return (0);
 }