~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to erts/etc/common/erlc.c

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
                                 */
118
118
    int eargv_size;
119
119
    int eargc_base;             /* How many arguments in the base of eargv. */
120
 
    char** orig_argv = argv;
121
120
    char* emulator;
122
 
    int can_use_ecc = 1;        /* All files are .erl files. */
123
 
 
124
 
    /*
125
 
     * XXX Currently, never use ecc.
126
 
     */
127
 
    can_use_ecc = 0;
128
121
 
129
122
    emulator = getenv("ERLC_EMULATOR");
130
123
    if (emulator == NULL) {
131
124
        emulator = get_default_emulator(argv[0]);
132
 
    } else {
133
 
        can_use_ecc = 0;
134
125
    }
135
126
 
136
 
#if defined(__WIN32__) || defined(VXWORKS)
137
 
    can_use_ecc = 0;            /* There is no ecc for Windows yet. */
138
 
#endif
139
 
 
140
127
    /*
141
128
     * Allocate the argv vector to be used for arguments to Erlang.
142
129
     * Arrange for starting to pushing information in the middle of
161
148
     */
162
149
 
163
150
    PUSH("-noinput");
 
151
    PUSH2("-mode", "minimal");
 
152
    PUSH2("-boot", "start_clean");
164
153
    PUSH3("-s", "erl_compile", "compile_cmdline");
165
154
    rpc_eargv = eargv+eargc;
166
155
 
248
237
                    } else {
249
238
                        char option[4];
250
239
 
251
 
                        can_use_ecc = 0; /* ecc cannot handle -pa/-pz */
252
240
                        UNSHIFT(process_opt(&argc, &argv, 1));
253
241
                        option[0] = '-';
254
242
                        option[1] = 'p';
258
246
                    }
259
247
                }
260
248
                break;
261
 
            case 'r':
262
 
                if (strcmp(argv[1], "-rpc") != 0)
263
 
                    goto error;
264
 
                break;
265
249
            case 's':
266
250
                if (argv[1][2] == '\0') {
267
251
                    ;
268
 
                } else if (strcmp(argv[1], "-stop") == 0) {
269
 
                    /*
270
 
                     * Not exiting here allows us to write:
271
 
                     *    erlc -stop jam file.erl
272
 
                     * to restart the compiler node before compiling.
273
 
                     */
274
252
                } else
275
253
                    goto error;
276
254
                break;
281
259
                /** XXX Version perhaps, but of what? **/
282
260
                break;
283
261
            case 'W':           /* Enable warnings. */
284
 
                PUSH2("@warn", "1");
 
262
                if (strcmp(argv[1]+2, "all") == 0) {
 
263
                    PUSH2("@warn", "999");
 
264
                } else if (isdigit((int)argv[1][2])) {
 
265
                    PUSH2("@warn", argv[1]+2);
 
266
                } else {
 
267
                    PUSH2("@warn", "1");
 
268
                }
285
269
                break;
286
270
            case 'E':
287
271
            case 'S':
334
318
 
335
319
    PUSH("@files");
336
320
    while (argc > 1) {
337
 
        char* p;
338
 
        if ((p = strrchr(argv[1], '.')) == NULL || strcmp(p, ".erl") != 0) {
339
 
            can_use_ecc = 0;
340
 
        }
341
321
        PUSH(argv[1]);
342
322
        argc--, argv++;
343
323
    }
344
324
 
345
325
    /*
346
 
     * If all files were .erl files, we can use ecc.
347
 
     */
348
 
 
349
 
    if (can_use_ecc) {
350
 
        orig_argv[0] = "ecc";
351
 
        return run_erlang(orig_argv[0], orig_argv);
352
 
    }
353
 
 
354
 
    /*
355
326
     * Move up the commands for invoking the emulator and adjust eargv
356
327
     * accordingly.
357
328
     */
544
515
        {"-help", "shows this help text"},
545
516
        {"-I path", "where to search for include files"},
546
517
        {"-o name", "name output directory or file"},
547
 
        {"-pa path", "add path to Erlang's code path"},
548
 
        {"-rpc", "use a running Erlang node for compilation"},
549
 
        {"-stop", "stop the compiler Erlang node (implies -rpc)"},
 
518
        {"-pa path", "add path to the front of Erlang's code path"},
 
519
        {"-pa path", "add path to the end of Erlang's code path"},
550
520
        {"-v", "verbose compiler output"},
551
 
        {"-W", "enable warnings"},
 
521
        {"-W0", "disable warnings"},
 
522
        {"-Wnumber", "set warning level to number"},
 
523
        {"-Wall", "enable all warnings"},
 
524
        {"-W", "enable warnings (default; same as -W1)"},
552
525
        {"-E", "generate listing of expanded code (Erlang compiler)"},
553
526
        {"-S", "generate assembly listing (Erlang compiler)"},
554
527
        {"-P", "generate listing of preprocessed code (Erlang compiler)"},