1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Cleanups.

committer: mfx <mfx> 1074623253 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2004-01-20 18:27:33 +00:00
parent f4022af48a
commit 19564ed27e
6 changed files with 75 additions and 90 deletions

View File

@ -88,11 +88,25 @@ endif
# /*********************************************************************** # /***********************************************************************
# // compression library # // compression libraries
# ************************************************************************/ # ************************************************************************/
ifeq ($(WITH_ZLIB),1) ifeq ($(WITH_ZLIB),1)
DOS_LDLIBS += zlib.lib DOS_LDLIBS += zlib.lib
ZLIBDIR:=$(strip $(subst \,/,$(ZLIBDIR)))
ifneq ($(strip $(wildcard $(ZLIBDIR))),)
ifneq ($(strip $(wildcard $(ZLIBDIR)/include/zlib.h)),)
INCLUDES += -I$(ZLIBDIR)/include
else
ifneq ($(strip $(wildcard $(ZLIBDIR)/src/zlib.h)),)
INCLUDES += -I$(ZLIBDIR)/src
else
ifneq ($(strip $(wildcard $(ZLIBDIR)/zlib.h)),)
INCLUDES += -I$(ZLIBDIR)
endif
endif
endif
endif
endif endif
UCLDIR:=$(strip $(subst \,/,$(UCLDIR))) UCLDIR:=$(strip $(subst \,/,$(UCLDIR)))
@ -132,7 +146,7 @@ endif
### ###
### linux ### linux - gcc
### ###
ifeq ($(target),linux) ifeq ($(target),linux)
@ -144,7 +158,6 @@ endif
DEFS += -D_FILE_OFFSET_BITS=64 DEFS += -D_FILE_OFFSET_BITS=64
LDLIBS += -lmcheck LDLIBS += -lmcheck
##CFLAGS_WERROR = -Werror ##CFLAGS_WERROR = -Werror
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
else else
##LDFLAGS += -static ##LDFLAGS += -static
@ -154,7 +167,6 @@ else
endif endif
endif endif
CHMOD_EXE = chmod 755 $@ CHMOD_EXE = chmod 755 $@
endif # linux endif # linux
@ -197,7 +209,6 @@ LINK_EXE_OUTPUT = -o $@
ifeq ($(WITH_ZLIB),1) ifeq ($(WITH_ZLIB),1)
LDLIBS += -lz LDLIBS += -lz
endif endif
CFLAGS = $(CFLAGS_WERROR) CFLAGS = $(CFLAGS_WERROR)
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS += -g -O0 CFLAGS += -g -O0
@ -205,7 +216,6 @@ else
CFLAGS += -O2 CFLAGS += -O2
endif endif
LDFLAGS += -Wl,-Map,$T.map LDFLAGS += -Wl,-Map,$T.map
endif endif
@ -223,7 +233,6 @@ LINK_EXE_OUTPUT = -o $@
ifeq ($(WITH_ZLIB),1) ifeq ($(WITH_ZLIB),1)
LDLIBS += -lz LDLIBS += -lz
endif endif
##CFLAGS += -Minform=info ##CFLAGS += -Minform=info
CXXFLAGS = $(CFLAGS) -tused CXXFLAGS = $(CFLAGS) -tused
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
@ -390,18 +399,11 @@ CFLAGS_OUTPUT = -o$@
LDFLAGS = -ls LDFLAGS = -ls
LINK_EXE_OUTPUT = -e$@ LINK_EXE_OUTPUT = -e$@
LDLIBS = $(DOS_LDLIBS) LDLIBS = $(DOS_LDLIBS)
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
endif
export LIB
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS += -Od -d CFLAGS += -Od -d
else else
CFLAGS += -O2 -d CFLAGS += -O2 -d
endif endif
endif # win32-bc endif # win32-bc
@ -420,18 +422,11 @@ CFLAGS_OUTPUT = -o$@
LDFLAGS = -L/map LDFLAGS = -L/map
LINK_EXE_OUTPUT = -o$@ LINK_EXE_OUTPUT = -o$@
LDLIBS = $(DOS_LDLIBS) LDLIBS = $(DOS_LDLIBS)
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
endif
export LIB
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS += -o- -g -s CFLAGS += -o- -g -s
else else
CFLAGS += -o CFLAGS += -o
endif endif
endif # win32-dm endif # win32-dm
@ -450,12 +445,6 @@ LDFLAGS =
LINK_EXE_OUTPUT = -Fe$@ LINK_EXE_OUTPUT = -Fe$@
LINK_EXE_LDFLAGS = /link /map:$T.map LINK_EXE_LDFLAGS = /link /map:$T.map
##LINK_EXE_LDFLAGS += /verbose ##LINK_EXE_LDFLAGS += /verbose
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
endif
export LIB
ifeq (1,2) ifeq (1,2)
# statically link libc.lib # statically link libc.lib
CC += -ML CC += -ML
@ -473,10 +462,32 @@ else
LINK_EXE_LDFLAGS += /release LINK_EXE_LDFLAGS += /release
endif endif
RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc))) RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc)))
endif # win32-ic endif # win32-ic
###
### win32 - Metrowerks C++
###
ifeq ($(target),win32-mwerks)
o = .obj
a = .lib
e = .exe
CC = mwcc -runtime ss -gccinc
CFLAGS = -w on
CXXFLAGS = $(CFLAGS)
CFLAGS_OUTPUT = -o $@
LDFLAGS = -map $T.map
LINK_EXE_OUTPUT = -o $@
LDLIBS = $(DOS_LDLIBS)
ifeq ($(DEBUG),1)
CFLAGS += -opt full
else
CFLAGS +=
endif
endif # win32-mwerks
### ###
### win32 - Symantec C++ ### win32 - Symantec C++
### ###
@ -492,18 +503,11 @@ CFLAGS_OUTPUT = -o$@
LDFLAGS = -L/map LDFLAGS = -L/map
LINK_EXE_OUTPUT = -o$@ LINK_EXE_OUTPUT = -o$@
LDLIBS = $(DOS_LDLIBS) LDLIBS = $(DOS_LDLIBS)
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
endif
export LIB
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS += -o- -g -s CFLAGS += -o- -g -s
else else
CFLAGS += -o CFLAGS += -o
endif endif
endif # win32-sc endif # win32-sc
@ -522,12 +526,6 @@ LDFLAGS =
LINK_EXE_OUTPUT = -Fe$@ LINK_EXE_OUTPUT = -Fe$@
LINK_EXE_LDFLAGS = /link /map:$T.map LINK_EXE_LDFLAGS = /link /map:$T.map
##LINK_EXE_LDFLAGS += /verbose ##LINK_EXE_LDFLAGS += /verbose
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
endif
export LIB
ifeq (1,1) ifeq (1,1)
# statically link libc.lib # statically link libc.lib
CC += -ML CC += -ML
@ -546,7 +544,6 @@ else
##LINK_EXE_LDFLAGS += /opt:nowin98 ##LINK_EXE_LDFLAGS += /opt:nowin98
endif endif
RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc))) RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc)))
endif # win32-vc endif # win32-vc
@ -566,7 +563,6 @@ CFLAGS_OUTPUT = -fo=$@
LDFLAGS = -k0x100000 -fm LDFLAGS = -k0x100000 -fm
LINK_EXE_OUTPUT = -fe=$@ LINK_EXE_OUTPUT = -fe=$@
LDLIBS = $(DOS_LDLIBS) LDLIBS = $(DOS_LDLIBS)
CC_SRC = $(subst /,\\,$<) CC_SRC = $(subst /,\\,$<)
CXX_SRC = $(subst /,\\,$<) CXX_SRC = $(subst /,\\,$<)
INCLUDES := $(strip $(subst /,\\,$(INCLUDES))) INCLUDES := $(strip $(subst /,\\,$(INCLUDES)))
@ -575,24 +571,17 @@ ifeq (1,2)
export WCL386 export WCL386
INCLUDES := INCLUDES :=
endif endif
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
endif
export LIB
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS += CFLAGS +=
else else
# note: it seems that the optimizer is generating bad code with `-ox' # note: it seems that the optimizer is generating bad code with `-ox'
CFLAGS += -olr CFLAGS += -olr
endif endif
endif # win32-wc endif # win32-wc
### ###
### win64 - Intel C++ [IA64] ### win64 - Intel C++ [Itanium]
### ###
ifeq ($(target),win64-ic) ifeq ($(target),win64-ic)
@ -606,12 +595,6 @@ LDFLAGS =
LINK_EXE_OUTPUT = -Fe$@ LINK_EXE_OUTPUT = -Fe$@
LINK_EXE_LDFLAGS = /link /map:$T.map LINK_EXE_LDFLAGS = /link /map:$T.map
##LINK_EXE_LDFLAGS += /verbose ##LINK_EXE_LDFLAGS += /verbose
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
endif
export LIB
ifeq (1,2) ifeq (1,2)
# statically link libc.lib # statically link libc.lib
CC += -ML CC += -ML
@ -629,12 +612,11 @@ else
LINK_EXE_LDFLAGS += /release LINK_EXE_LDFLAGS += /release
endif endif
RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc))) RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc)))
endif # win64-ic endif # win64-ic
### ###
### win64 - Visual C++ [AMD64 & IA64] ### win64 - Visual C++ [AMD64 or Itanium]
### ###
ifeq ($(target),win64-vc) ifeq ($(target),win64-vc)
@ -648,12 +630,6 @@ LDFLAGS =
LINK_EXE_OUTPUT = -Fe$@ LINK_EXE_OUTPUT = -Fe$@
LINK_EXE_LDFLAGS = /link /map:$T.map LINK_EXE_LDFLAGS = /link /map:$T.map
##LINK_EXE_LDFLAGS += /verbose ##LINK_EXE_LDFLAGS += /verbose
ifneq ($(strip $(DOS_LIBDIRS)),)
LIB := $(DOS_LIBDIRS);$(LIB)
endif
export LIB
ifeq (1,1) ifeq (1,1)
# statically link libc.lib # statically link libc.lib
CC += -ML CC += -ML
@ -671,12 +647,11 @@ else
LINK_EXE_LDFLAGS += /release LINK_EXE_LDFLAGS += /release
endif endif
RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc))) RESOURCES := $(subst .rc,.res,$(notdir $(wildcard $(srcdir)/*.rc)))
endif # win64-vc endif # win64-vc
# /*********************************************************************** # /***********************************************************************
# // malloc debuggers and memory checkers - somewhat obsolete, use valgrind # // malloc debuggers and memory checkers - obsolete, use valgrind
# ************************************************************************/ # ************************************************************************/
ifeq (1,2) ifeq (1,2)

View File

@ -37,6 +37,9 @@
**************************************************************************/ **************************************************************************/
#include "acc/acc.h" #include "acc/acc.h"
#if (ACC_OS_WIN32 && ACC_CC_MWERKS) && defined(__MSL__)
# undef HAVE_UTIME_H /* this pulls in <windows.h> */
#endif
#include "acc/acc_incd.h" #include "acc/acc_incd.h"
#include "acc/acc_ince.h" #include "acc/acc_ince.h"
#include "acc/acc_lib.h" #include "acc/acc_lib.h"

View File

@ -21,22 +21,25 @@
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef EOF
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#endif
#undef progname
#undef PROGNAME
#if 1 #if 1
#define progname(x) (x) #define PROGNAME(x) (x)
#else #else
#include "conf.h" #include "conf.h"
static const char *my_progname(const char *argv0) static const char *my_progname(const char *argv0)
{ {
UNUSED(argv0);
return progname ? progname : argv0; return progname ? progname : argv0;
} }
#define progname my_progname #define PROGNAME(x) my_progname(x)
#endif #endif
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a /* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
long-named option. Because this is not POSIX.2 compliant, it is long-named option. Because this is not POSIX.2 compliant, it is
being phased out. */ being phased out. */
@ -425,7 +428,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
{ {
if (opterr) if (opterr)
fprintf (stderr, "%s: unrecognized option `%s'\n", fprintf (stderr, "%s: unrecognized option `%s'\n",
progname(argv[0]), argv[optind]); PROGNAME(argv[0]), argv[optind]);
nextchar += strlen (nextchar); nextchar += strlen (nextchar);
optind++; optind++;
return BAD_OPTION; return BAD_OPTION;
@ -434,7 +437,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
{ {
if (opterr) if (opterr)
fprintf (stderr, "%s: option `%s' is ambiguous\n", fprintf (stderr, "%s: option `%s' is ambiguous\n",
progname(argv[0]), argv[optind]); PROGNAME(argv[0]), argv[optind]);
nextchar += strlen (nextchar); nextchar += strlen (nextchar);
optind++; optind++;
return BAD_OPTION; return BAD_OPTION;
@ -461,12 +464,12 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
/* --option */ /* --option */
fprintf (stderr, fprintf (stderr,
"%s: option `--%s' doesn't allow an argument\n", "%s: option `--%s' doesn't allow an argument\n",
progname(argv[0]), pfound->name); PROGNAME(argv[0]), pfound->name);
else else
/* +option or -option */ /* +option or -option */
fprintf (stderr, fprintf (stderr,
"%s: option `%c%s' doesn't allow an argument\n", "%s: option `%c%s' doesn't allow an argument\n",
progname(argv[0]), argv[optind - 1][0], pfound->name); PROGNAME(argv[0]), argv[optind - 1][0], pfound->name);
} }
nextchar += strlen (nextchar); nextchar += strlen (nextchar);
return BAD_OPTION; return BAD_OPTION;
@ -484,7 +487,7 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
{ {
if (opterr) if (opterr)
fprintf (stderr, "%s: option `--%s%s' requires an argument\n", fprintf (stderr, "%s: option `--%s%s' requires an argument\n",
progname(argv[0]), pfound->name, PROGNAME(argv[0]), pfound->name,
(pfound->has_arg & 0x20) ? "=" : ""); (pfound->has_arg & 0x20) ? "=" : "");
nextchar += strlen (nextchar); nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : BAD_OPTION; return optstring[0] == ':' ? ':' : BAD_OPTION;
@ -515,11 +518,11 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
if (argv[optind][1] == '-') if (argv[optind][1] == '-')
/* --option */ /* --option */
fprintf (stderr, "%s: unrecognized option `--%s'\n", fprintf (stderr, "%s: unrecognized option `--%s'\n",
progname(argv[0]), nextchar); PROGNAME(argv[0]), nextchar);
else else
/* +option or -option */ /* +option or -option */
fprintf (stderr, "%s: unrecognized option `%c%s'\n", fprintf (stderr, "%s: unrecognized option `%c%s'\n",
progname(argv[0]), argv[optind][0], nextchar); PROGNAME(argv[0]), argv[optind][0], nextchar);
} }
nextchar = empty_string; nextchar = empty_string;
optind++; optind++;
@ -545,12 +548,12 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
#if 0 #if 0
if (c < 040 || c >= 0177) if (c < 040 || c >= 0177)
fprintf (stderr, "%s: unrecognized option, character code 0%o\n", fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
progname(argv[0]), c); PROGNAME(argv[0]), c);
else else
fprintf (stderr, "%s: unrecognized option `-%c'\n", progname(argv[0]), c); fprintf (stderr, "%s: unrecognized option `-%c'\n", PROGNAME(argv[0]), c);
#else #else
/* 1003.2 specifies the format of this message. */ /* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: illegal option -- %c\n", progname(argv[0]), c); fprintf (stderr, "%s: illegal option -- %c\n", PROGNAME(argv[0]), c);
#endif #endif
} }
optopt = c; optopt = c;
@ -586,11 +589,11 @@ static int _getopt_internal (int argc, char **argv, const char *optstring,
{ {
#if 0 #if 0
fprintf (stderr, "%s: option `-%c' requires an argument\n", fprintf (stderr, "%s: option `-%c' requires an argument\n",
progname(argv[0]), c); PROGNAME(argv[0]), c);
#else #else
/* 1003.2 specifies the format of this message. */ /* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: option requires an argument -- %c\n", fprintf (stderr, "%s: option requires an argument -- %c\n",
progname(argv[0]), c); PROGNAME(argv[0]), c);
#endif #endif
} }
optopt = c; optopt = c;
@ -697,6 +700,7 @@ main (argc, argv)
#endif /* TEST */ #endif /* TEST */
/* /*
vi:ts=4:et:nowrap vi:ts=4:et:nowrap
*/ */

View File

@ -19,7 +19,7 @@
#define __MFX_GETOPT_H 1 #define __MFX_GETOPT_H 1
#ifdef __cplusplus #ifdef __cplusplus
//extern "C" { /* extern "C" { */
#endif #endif
/* For communication from `getopt' to the caller. /* For communication from `getopt' to the caller.
@ -96,7 +96,7 @@ int mfx_getopt_long(int argc, char **argv, const char *shortopts,
const struct mfx_option *longopts, int *longind); const struct mfx_option *longopts, int *longind);
#ifdef __cplusplus #ifdef __cplusplus
//} /* } */
#endif #endif
#endif /* _GETOPT_H */ #endif /* __MFX_GETOPT_H */

View File

@ -34,7 +34,7 @@
#include "acc/acc_cxx.h" #include "acc/acc_cxx.h"
#define NOTHROW ACC_CXX_NOTHROW #define NOTHROW ACC_CXX_NOTHROW
#define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE_STRICT #define DISABLE_NEW_DELETE ACC_CXX_DISABLE_NEW_DELETE
/************************************************************************* /*************************************************************************

View File

@ -35,13 +35,16 @@
#define ALWAYS_CHMOD 1 #define ALWAYS_CHMOD 1
#if defined(__DJGPP__) #if defined(__DJGPP__)
# define USE_FTIME # define USE_FTIME 1
# undef ALWAYS_CHMOD # undef ALWAYS_CHMOD
#elif (ACC_OS_WIN32 && ACC_CC_MWERKS) && defined(__MSL__)
# include <utime.h>
# define USE_UTIME 1
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_INTELC || ACC_CC_MSC)) #elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_INTELC || ACC_CC_MSC))
# define USE__FUTIME # define USE__FUTIME 1
# undef ALWAYS_CHMOD # undef ALWAYS_CHMOD
#elif defined(HAVE_UTIME) #elif defined(HAVE_UTIME)
# define USE_UTIME # define USE_UTIME 1
#endif #endif
#if !defined(SH_DENYRW) #if !defined(SH_DENYRW)