comparison src/main.c @ 299:460d96987670

parse linking scripts
author lost
date Wed, 21 Jan 2009 04:54:32 +0000
parents c52ad3135bd3
children 48945dac8178
comparison
equal deleted inserted replaced
298:96a35a4245f3 299:460d96987670
44 case 'o': 44 case 'o':
45 // output 45 // output
46 outfile = arg; 46 outfile = arg;
47 break; 47 break;
48 48
49 case 's':
50 // script file
51 scriptfile = arg;
52 break;
53
49 case 'd': 54 case 'd':
50 // debug 55 // debug
51 debug_level++; 56 debug_level++;
52 break; 57 break;
53 58
99 "Select output format: decb, raw, obj"}, 104 "Select output format: decb, raw, obj"},
100 { "decb", 'b', 0, 0, 105 { "decb", 'b', 0, 0,
101 "Generate DECB .bin format output, equivalent of --format=decb"}, 106 "Generate DECB .bin format output, equivalent of --format=decb"},
102 { "raw", 'r', 0, 0, 107 { "raw", 'r', 0, 0,
103 "Generate raw binary format output, equivalent of --format=raw"}, 108 "Generate raw binary format output, equivalent of --format=raw"},
109 { "script", 's', 0, 0,
110 "Specify the linking script (overrides the build in defaults)"},
104 { 0 } 111 { 0 }
105 }; 112 };
106 113
107 static struct argp argp = 114 static struct argp argp =
108 { 115 {
111 "<input file> ...", 118 "<input file> ...",
112 "LWLINK, a HD6309 and MC6809 cross-linker" 119 "LWLINK, a HD6309 and MC6809 cross-linker"
113 }; 120 };
114 121
115 extern void read_files(void); 122 extern void read_files(void);
123 extern void setup_script(void);
116 124
117 // main function; parse command line, set up assembler state, and run the 125 // main function; parse command line, set up assembler state, and run the
118 // assembler on the first file 126 // assembler on the first file
119 int main(int argc, char **argv) 127 int main(int argc, char **argv)
120 { 128 {
123 { 131 {
124 fprintf(stderr, "No input files\n"); 132 fprintf(stderr, "No input files\n");
125 exit(1); 133 exit(1);
126 } 134 }
127 135
136 setup_script();
137
128 // read the input files 138 // read the input files
129 read_files(); 139 read_files();
130 140
131 exit(0); 141 exit(0);
132 } 142 }