mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Replace system defines/includes with qfcc's
Right now, it probably works only with modern gcc.
This commit is contained in:
parent
2f726a497b
commit
d4574111b5
5 changed files with 50 additions and 7 deletions
|
@ -9,7 +9,7 @@ AC_ARG_WITH(cpp,
|
|||
if test "x$cpp_name" != xauto; then
|
||||
CPP_NAME="$cpp_name"
|
||||
else
|
||||
CPP_NAME="cpp %d -o %o %i"
|
||||
CPP_NAME="cpp %u %d %s -o %o %i"
|
||||
case "$host_os" in
|
||||
*freebsd*)
|
||||
CPP_NAME="cpp %d %i %o"
|
||||
|
|
|
@ -30,7 +30,7 @@ AC_ARG_WITH(cpp,
|
|||
if test "x$cpp_name" != xauto; then
|
||||
CPP_NAME="$cpp_name"
|
||||
else
|
||||
CPP_NAME="cpp %d -o %o %i"
|
||||
CPP_NAME="cpp %u %d %s -o %o %i"
|
||||
case "$target_os" in
|
||||
*bsd*)
|
||||
touch conftest.c
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
struct dstring_s;
|
||||
|
||||
void parse_cpp_name (void);
|
||||
void add_cpp_sysinc (const char *arg);
|
||||
void add_cpp_undef (const char *arg);
|
||||
void add_cpp_def (const char *arg);
|
||||
void intermediate_file (struct dstring_s *ifile, const char *filename,
|
||||
const char *ext, int local);
|
||||
|
|
|
@ -67,11 +67,25 @@ cpp_arg_t *cpp_arg_list;
|
|||
cpp_arg_t **cpp_arg_tail = &cpp_arg_list;
|
||||
cpp_arg_t *cpp_def_list;
|
||||
cpp_arg_t **cpp_def_tail = &cpp_def_list;
|
||||
cpp_arg_t *cpp_undef_list;
|
||||
cpp_arg_t **cpp_undef_tail = &cpp_undef_list;
|
||||
cpp_arg_t *cpp_sysinc_list;
|
||||
cpp_arg_t **cpp_sysinc_tail = &cpp_sysinc_list;
|
||||
const char **cpp_argv;
|
||||
const char *cpp_name = CPP_NAME;
|
||||
static int cpp_argc = 0;
|
||||
dstring_t *tempname;
|
||||
|
||||
static const char **
|
||||
append_cpp_args (const char **arg, cpp_arg_t *arg_list)
|
||||
{
|
||||
cpp_arg_t *cpp_arg;
|
||||
|
||||
for (cpp_arg = arg_list; cpp_arg; cpp_arg = cpp_arg->next)
|
||||
*arg++ = cpp_arg->arg;
|
||||
return arg;
|
||||
}
|
||||
|
||||
static void
|
||||
add_cpp_arg (const char *arg)
|
||||
{
|
||||
|
@ -83,6 +97,28 @@ add_cpp_arg (const char *arg)
|
|||
cpp_argc++;
|
||||
}
|
||||
|
||||
void
|
||||
add_cpp_sysinc (const char *arg)
|
||||
{
|
||||
cpp_arg_t *cpp_arg = malloc (sizeof (cpp_arg_t));
|
||||
cpp_arg->next = 0;
|
||||
cpp_arg->arg = arg;
|
||||
*cpp_sysinc_tail = cpp_arg;
|
||||
cpp_sysinc_tail = &(*cpp_sysinc_tail)->next;
|
||||
cpp_argc++;
|
||||
}
|
||||
|
||||
void
|
||||
add_cpp_undef (const char *arg)
|
||||
{
|
||||
cpp_arg_t *cpp_arg = malloc (sizeof (cpp_arg_t));
|
||||
cpp_arg->next = 0;
|
||||
cpp_arg->arg = arg;
|
||||
*cpp_undef_tail = cpp_arg;
|
||||
cpp_undef_tail = &(*cpp_undef_tail)->next;
|
||||
cpp_argc++;
|
||||
}
|
||||
|
||||
void
|
||||
add_cpp_def (const char *arg)
|
||||
{
|
||||
|
@ -117,7 +153,6 @@ static void
|
|||
build_cpp_args (const char *in_name, const char *out_name)
|
||||
{
|
||||
cpp_arg_t *cpp_arg;
|
||||
cpp_arg_t *cpp_def;
|
||||
const char **arg;
|
||||
|
||||
if (cpp_argv)
|
||||
|
@ -126,9 +161,12 @@ build_cpp_args (const char *in_name, const char *out_name)
|
|||
for (arg = cpp_argv, cpp_arg = cpp_arg_list;
|
||||
cpp_arg;
|
||||
cpp_arg = cpp_arg->next) {
|
||||
if (!strcmp (cpp_arg->arg, "%d")) {
|
||||
for (cpp_def = cpp_def_list; cpp_def; cpp_def = cpp_def->next)
|
||||
*arg++ = cpp_def->arg;
|
||||
if (!strcmp (cpp_arg->arg, "%u")) {
|
||||
arg = append_cpp_args (arg, cpp_undef_list);
|
||||
} else if (!strcmp (cpp_arg->arg, "%s")) {
|
||||
arg = append_cpp_args (arg, cpp_sysinc_list);
|
||||
} else if (!strcmp (cpp_arg->arg, "%d")) {
|
||||
arg = append_cpp_args (arg, cpp_def_list);
|
||||
} else if (!strcmp (cpp_arg->arg, "%i")) {
|
||||
*arg++ = in_name;
|
||||
} else if (!strcmp (cpp_arg->arg, "%o")) {
|
||||
|
|
|
@ -299,6 +299,8 @@ DecodeArgs (int argc, char **argv)
|
|||
int c;
|
||||
int saw_E = 0, saw_MD = 0;
|
||||
|
||||
add_cpp_undef ("-undef");
|
||||
add_cpp_undef ("-nostdinc");
|
||||
add_cpp_def ("-D__QFCC__=1");
|
||||
add_cpp_def ("-D__QUAKEC__=1");
|
||||
|
||||
|
@ -720,7 +722,8 @@ DecodeArgs (int argc, char **argv)
|
|||
|
||||
// add the default paths
|
||||
if (!options.no_default_paths) {
|
||||
add_cpp_def (nva ("-I%s", QFCC_INCLUDE_PATH));
|
||||
add_cpp_sysinc ("-isystem");
|
||||
add_cpp_sysinc (QFCC_INCLUDE_PATH);
|
||||
linker_add_path (QFCC_LIB_PATH);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue