diff --git a/.gitignore b/.gitignore index 567609b..4e9c87a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build/ +bin/ \ No newline at end of file diff --git a/Makefile.dos b/Makefile.dos index 3f16e3c..fbb4ed6 100644 --- a/Makefile.dos +++ b/Makefile.dos @@ -11,20 +11,57 @@ NOARCH=noarch SRC_DIR=$(shell pwd) BUILDDIR ?= $(shell pwd)/build +OLEVEL=O3 +OCPU=486 +OLTO=yes +OASM=yes + +ifeq "$(OCPU)" "386" + OARCH=i486 + OTUNE=i386 +else ifeq "$(OCPU)" "486" + OARCH=i486 + OTUNE=i486 +else ifeq "$(OCPU)" "586" + OARCH=pentium + OTUNE=pentium +else ifeq "$(OCPU)" "686" + OARCH=pentiumpro + OTUNE=pentiumpro +else + $(error unknown cpu type $(OCPU)) +endif + +BINNAME=$(OCPU)q$(OLEVEL)$(LTOCHAR) + +ifeq "$(OLTO)" "yes" + LTOFLAGS=-flto + BINNAME:=$(BINNAME)l +endif + +ifneq "$(OASM)" "yes" + ID386=0 + BINNAME:=$(BINNAME)c +else + ID386=1 +endif + BUILD_DEBUG_DIR=debug$(ARCH)$(GLIBC) BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC) CC=i586-pc-msdosdjgpp-gcc -BASE_CFLAGS=-Dstricmp=strcasecmp -RELEASE_CFLAGS=$(BASE_CFLAGS) -s -Os -march=i486 -mtune=i386 -ffast-math \ +CC_VERSION=$(shell $(CC) --version | head -n 1 | awk -F " " '{print $3}') + +BASE_CFLAGS=-Dstricmp=strcasecmp -DSUBARCH=$(OCPU) -DOLEVEL="\"$(OLEVEL)\"" -DLTOFLAGS="\" $(LTOFLAGS)\"" -Did386=$(ID386) -DCCVERSION="\"$(CC_VERSION)\"" +RELEASE_CFLAGS=$(BASE_CFLAGS) -s -$(OLEVEL) -march=$(OARCH) -mtune=$(OTUNE) -ffast-math \ -fno-unwind-tables -fno-asynchronous-unwind-tables -funroll-loops \ -fomit-frame-pointer -fexpensive-optimizations -flto \ DEBUG_CFLAGS=$(BASE_CFLAGS) -g CFLAGS?=$(BASE_CFLAGS) $(RELEASE_CFLAGS) -LDFLAGS=-lm -flto +LDFLAGS=-lm DO_CC=$(CC) $(CFLAGS) -o $@ -c $< DO_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -o $@ -c $< @@ -35,14 +72,14 @@ DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $< # SETUP AND BUILD ############################################################################# -TARGETS=$(BUILDDIR)/486quake.exe +TARGETS=$(BUILDDIR)/$(BINNAME).exe -build_release: $(BUILDDIR)/486quake.exe +build_release: $(BUILDDIR)/$(BINNAME).exe $(BUILDDIR)/486quake: - mkdir -p $(BUILDDIR)/486quake + mkdir -p $(BUILDDIR)/$(BINNAME) -all: $(BUILDDIR)/486quake build_release $(TARGETS) +all: $(BUILDDIR)/$(BINNAME).exe build_release $(TARGETS) ############################################################################# # SVGALIB Quake @@ -151,9 +188,15 @@ all: $(BUILDDIR)/486quake build_release $(TARGETS) $(BUILDDIR)/486quake/r_aclipa.o \ $(BUILDDIR)/486quake/snd_mixa.o \ $(BUILDDIR)/486quake/sys_dosa.o + +ifneq "$(OASM)" "yes" +486QUAKE_COBJS = \ + $(BUILDDIR)/486quake/d_vars.o \ + +endif -$(BUILDDIR)/486quake.exe : $(486QUAKE_OBJS) - $(CC) $(RELEASE_CFLAGS) -o $@ $(486QUAKE_OBJS) $(SVGALDFLAGS) $(LDFLAGS) +$(BUILDDIR)/$(BINNAME).exe : $(486QUAKE_OBJS) $(486QUAKE_COBJS) + $(CC) $(RELEASE_CFLAGS) -o $@ $(486QUAKE_COBJS) $(486QUAKE_OBJS) $(LDFLAGS) #### diff --git a/build_all.sh b/build_all.sh new file mode 100755 index 0000000..763cb97 --- /dev/null +++ b/build_all.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e -x + +rm -rf build bin + +mkdir -p build/486quake +mkdir -p bin + +for cpu in 386 486 586 686; do + for olevel in Os O2 O3; do + for olto in yes no; do + for oasm in yes no; do + make -f Makefile.dos clean + make -j8 -f Makefile.dos OCPU=$cpu OLEVEL=$olevel OLTO=$olto OASM=$oasm + cp build/*.exe bin/ + done + done + done +done \ No newline at end of file diff --git a/cd_audio.c b/cd_audio.c index 0393422..459d1c9 100644 --- a/cd_audio.c +++ b/cd_audio.c @@ -817,7 +817,7 @@ int CDAudio_Init(void) dos_int86 (0x2f); if (regs.x.bx == 0) { - Con_NotifyBox ( + Con_Printf ( "MSCDEX not loaded, music is\n" "disabled. Use \"-nocdaudio\" if you\n" "wish to avoid this message in the\n" @@ -834,7 +834,7 @@ int CDAudio_Init(void) dos_int86 (0x2f); if (regs.x.bx == 0) { - Con_NotifyBox ( + Con_Printf ( "MSCDEX version 2.00 or later\n" "required for music. See README.TXT\n" "for help.\n" diff --git a/cl_demo.c b/cl_demo.c index 550368e..4c31f08 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -335,6 +335,12 @@ void CL_FinishTimeDemo (void) if (!time) time = 1; Con_Printf ("%i frames %5.1f seconds %5.1f fps\n", frames, time, frames/time); +#if id386 + Con_Printf (" on %iQuake -%s%s v%4.2f\n", SUBARCH, OLEVEL, LTOFLAGS, VERSION); +#else + Con_Printf (" on %iQuake -%s%s noasm v%4.2f\n", SUBARCH, OLEVEL, LTOFLAGS, VERSION); +#endif + Con_Printf (" %s\n", CCVERSION); } /* diff --git a/d_vars.c b/d_vars.c index 9c9805d..611bc09 100644 --- a/d_vars.c +++ b/d_vars.c @@ -19,8 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // r_vars.c: global refresh variables -#if !id386 - #include "quakedef.h" // all global and static refresh variables are collected in a contiguous block @@ -45,6 +43,3 @@ pixel_t *d_viewbuffer; short *d_pzbuffer; unsigned int d_zrowbytes; unsigned int d_zwidth; - -#endif // !id386 - diff --git a/draw.c b/draw.c index 20cd529..a01ef63 100644 --- a/draw.c +++ b/draw.c @@ -543,7 +543,7 @@ void Draw_ConsoleBackground (int lines) unsigned short *pusdest; int f, fstep; qpic_t *conback; - char ver[100]; + char ver[256]; conback = Draw_CachePic ("gfx/conback.lmp"); @@ -557,9 +557,12 @@ void Draw_ConsoleBackground (int lines) #elif defined(__linux__) sprintf (ver, "(Linux Quake %2.2f) %4.2f", (float)LINUX_VERSION, (float)VERSION); dest = conback->data + 320*186 + 320 - 11 - 8*strlen(ver); +#elif defined(id386) + sprintf (ver, "%iquake -%s%s %4.2f", SUBARCH, OLEVEL, LTOFLAGS, VERSION); + dest = conback->data + 320*186 + 320 - 11 - 8*strlen(ver); #else - dest = conback->data + 320 - 43 + 320*186; - sprintf (ver, "486quake %4.2f", VERSION); + sprintf (ver, "%iquake -%s%s noasm %4.2f", SUBARCH, OLEVEL, LTOFLAGS, VERSION); + dest = conback->data + 320*186 + 320 - 11 - 8*strlen(ver); #endif for (x=0 ; x