mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
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
This commit is contained in:
@@ -118,19 +118,23 @@ main(int argc, char *argv[])
|
|||||||
int ch;
|
int ch;
|
||||||
char *ep;
|
char *ep;
|
||||||
|
|
||||||
SLONG argn = 0;
|
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
usage();
|
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) {
|
switch (ch) {
|
||||||
|
case 'l':
|
||||||
|
lib_Readfile(optarg);
|
||||||
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
SetMapfileName(optarg);
|
SetMapfileName(optarg);
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
SetSymfileName(optarg);
|
SetSymfileName(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'o':
|
||||||
|
out_Setname(optarg);
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
options |= OPT_SMART_C_LINK;
|
options |= OPT_SMART_C_LINK;
|
||||||
strcpy(smartlinkstartsymbol, optarg);
|
strcpy(smartlinkstartsymbol, optarg);
|
||||||
@@ -171,16 +175,18 @@ main(int argc, char *argv[])
|
|||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 0)
|
||||||
ProcessLinkfile(argv[argc - 1]);
|
usage();
|
||||||
|
|
||||||
|
for (int i = 0; i < argc; ++i)
|
||||||
|
obj_Readfile(argv[i]);
|
||||||
|
|
||||||
AddNeededModules();
|
AddNeededModules();
|
||||||
AssignSections();
|
AssignSections();
|
||||||
CreateSymbolTable();
|
CreateSymbolTable();
|
||||||
Patch();
|
Patch();
|
||||||
Output();
|
Output();
|
||||||
CloseMapfile();
|
CloseMapfile();
|
||||||
} else
|
|
||||||
usage();
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user