mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
make control of progdefs.h generation saner
This commit is contained in:
parent
e8e2d3a6e5
commit
a376e6f86d
3 changed files with 25 additions and 10 deletions
|
@ -76,6 +76,7 @@ typedef struct {
|
||||||
// that
|
// that
|
||||||
qboolean save_temps; // save temporary files
|
qboolean save_temps; // save temporary files
|
||||||
qboolean files_dat; // generate files.dat
|
qboolean files_dat; // generate files.dat
|
||||||
|
qboolean progdefs_h; // generate progdefs.h
|
||||||
qboolean traditional; // behave more like qcc
|
qboolean traditional; // behave more like qcc
|
||||||
qboolean advanced; // behold the power of Ruamoko
|
qboolean advanced; // behold the power of Ruamoko
|
||||||
qboolean compile; // serparate compilation mode
|
qboolean compile; // serparate compilation mode
|
||||||
|
|
|
@ -58,23 +58,34 @@ const char **source_files;
|
||||||
static int num_files;
|
static int num_files;
|
||||||
static int files_size;
|
static int files_size;
|
||||||
|
|
||||||
|
// keep me sane when adding long options :P
|
||||||
|
enum {
|
||||||
|
start_opts = 255, // not used, just for starting the enum.
|
||||||
|
OPT_ADVANCED,
|
||||||
|
OPT_CPP,
|
||||||
|
OPT_INCLUDE,
|
||||||
|
OPT_PROGDEFS,
|
||||||
|
OPT_TRADITIONAL,
|
||||||
|
};
|
||||||
|
|
||||||
static struct option const long_options[] = {
|
static struct option const long_options[] = {
|
||||||
{"advanced", no_argument, 0, 258},
|
{"advanced", no_argument, 0, OPT_ADVANCED},
|
||||||
{"code", required_argument, 0, 'C'},
|
{"code", required_argument, 0, 'C'},
|
||||||
{"cpp", required_argument, 0, 256},
|
{"cpp", required_argument, 0, OPT_CPP},
|
||||||
{"define", required_argument, 0, 'D'},
|
{"define", required_argument, 0, 'D'},
|
||||||
{"files", no_argument, 0, 'F'},
|
{"files", no_argument, 0, 'F'},
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, 0, 'h'},
|
||||||
{"include", required_argument, 0, 259},
|
{"include", required_argument, 0, OPT_INCLUDE},
|
||||||
{"notice", required_argument, 0, 'N'},
|
{"notice", required_argument, 0, 'N'},
|
||||||
{"output-file", required_argument, 0, 'o'},
|
{"output-file", required_argument, 0, 'o'},
|
||||||
|
{"progdefs", no_argument, 0, OPT_PROGDEFS},
|
||||||
{"progs-src", required_argument, 0, 'P'},
|
{"progs-src", required_argument, 0, 'P'},
|
||||||
{"quiet", no_argument, 0, 'q'},
|
{"quiet", no_argument, 0, 'q'},
|
||||||
{"relocatable", no_argument, 0, 'r'},
|
{"relocatable", no_argument, 0, 'r'},
|
||||||
{"save-temps", no_argument, 0, 'S'},
|
{"save-temps", no_argument, 0, 'S'},
|
||||||
{"source", required_argument, 0, 's'},
|
{"source", required_argument, 0, 's'},
|
||||||
{"strip-path", required_argument, 0, 'p'},
|
{"strip-path", required_argument, 0, 'p'},
|
||||||
{"traditional", no_argument, 0, 257},
|
{"traditional", no_argument, 0, OPT_TRADITIONAL},
|
||||||
{"undefine", required_argument, 0, 'U'},
|
{"undefine", required_argument, 0, 'U'},
|
||||||
{"verbose", no_argument, 0, 'v'},
|
{"verbose", no_argument, 0, 'v'},
|
||||||
{"version", no_argument, 0, 'V'},
|
{"version", no_argument, 0, 'V'},
|
||||||
|
@ -310,6 +321,9 @@ DecodeArgs (int argc, char **argv)
|
||||||
case 'F':
|
case 'F':
|
||||||
options.files_dat = true;
|
options.files_dat = true;
|
||||||
break;
|
break;
|
||||||
|
case OPT_PROGDEFS:
|
||||||
|
options.progdefs_h = true;
|
||||||
|
break;
|
||||||
case 'q': // quiet
|
case 'q': // quiet
|
||||||
options.verbosity -= 1;
|
options.verbosity -= 1;
|
||||||
break;
|
break;
|
||||||
|
@ -319,12 +333,12 @@ DecodeArgs (int argc, char **argv)
|
||||||
case 'g': // debug
|
case 'g': // debug
|
||||||
options.code.debug = true;
|
options.code.debug = true;
|
||||||
break;
|
break;
|
||||||
case 257: // traditional
|
case OPT_TRADITIONAL:
|
||||||
options.traditional = true;
|
options.traditional = true;
|
||||||
options.advanced = false;
|
options.advanced = false;
|
||||||
options.code.progsversion = PROG_ID_VERSION;
|
options.code.progsversion = PROG_ID_VERSION;
|
||||||
break;
|
break;
|
||||||
case 258: // advanced
|
case OPT_ADVANCED:
|
||||||
options.traditional = false;
|
options.traditional = false;
|
||||||
options.advanced = true;
|
options.advanced = true;
|
||||||
options.code.progsversion = PROG_VERSION;
|
options.code.progsversion = PROG_VERSION;
|
||||||
|
@ -468,7 +482,7 @@ DecodeArgs (int argc, char **argv)
|
||||||
free (opts);
|
free (opts);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 256: // --cpp=
|
case OPT_CPP: // --cpp=
|
||||||
cpp_name = save_string (optarg);
|
cpp_name = save_string (optarg);
|
||||||
break;
|
break;
|
||||||
case 'S': // save temps
|
case 'S': // save temps
|
||||||
|
@ -482,7 +496,7 @@ DecodeArgs (int argc, char **argv)
|
||||||
options.preprocess_only = 1;
|
options.preprocess_only = 1;
|
||||||
add_cpp_def ("-E");
|
add_cpp_def ("-E");
|
||||||
break;
|
break;
|
||||||
case 259: // include-file
|
case OPT_INCLUDE: // include-file
|
||||||
add_cpp_def (nva ("%s", "-include"));
|
add_cpp_def (nva ("%s", "-include"));
|
||||||
add_cpp_def (nva ("%s", optarg));
|
add_cpp_def (nva ("%s", optarg));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -649,7 +649,7 @@ separate_compile (void)
|
||||||
finish_compilation ();
|
finish_compilation ();
|
||||||
|
|
||||||
// write progdefs.h
|
// write progdefs.h
|
||||||
if (options.code.progsversion == PROG_ID_VERSION)
|
if (options.progdefs_h)
|
||||||
crc = WriteProgdefs ("progdefs.h");
|
crc = WriteProgdefs ("progdefs.h");
|
||||||
|
|
||||||
WriteData (crc);
|
WriteData (crc);
|
||||||
|
@ -866,7 +866,7 @@ progs_src_compile (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// write progdefs.h
|
// write progdefs.h
|
||||||
if (options.code.progsversion == PROG_ID_VERSION)
|
if (options.progdefs_h)
|
||||||
crc = WriteProgdefs ("progdefs.h");
|
crc = WriteProgdefs ("progdefs.h");
|
||||||
|
|
||||||
// write data file
|
// write data file
|
||||||
|
|
Loading…
Reference in a new issue