Build improvements, support files moved to "data" folder.

This commit is contained in:
Scott Duensing 2021-11-20 16:27:43 -06:00
parent bd2bc76c8b
commit bea760abc6
13 changed files with 89 additions and 37 deletions

6
.gitignore vendored
View file

@ -3,6 +3,6 @@ build-*
*.user *.user
*.o *.o
client/bin/ bin/
client/obj/ obj/
client/retired/ retired/

View file

@ -26,16 +26,15 @@ DEBUG = -g
## CHANGE THIS ## ## CHANGE THIS ##
TARGET = client TARGET = client
SRCDIR = src SRCDIR = .
SHARED = ../shared
OBJDIR = obj OBJDIR = obj
BINDIR = bin BINDIR = bin
## CHANGE THIS ## ## CHANGE THIS ##
# CFLAGS, LDFLAGS, CPPFLAGS, PREFIX can be overriden on CLI # CFLAGS, LDFLAGS, CPPFLAGS, PREFIX can be overriden on CLI
CFLAGS := $(DEBUG) CFLAGS := $(DEBUG)
CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/system -I$(SRCDIR)/dos -I$(SRCDIR)/gui -I$(SRCDIR)/thirdparty CFLAGS += -I$(SRCDIR)/client/src -I$(SRCDIR)/client/src/system -I$(SRCDIR)/client/src/dos -I$(SRCDIR)/client/src/gui -I$(SRCDIR)/client/src/thirdparty
CFLAGS += -I$(SHARED) -I$(SHARED)/thirdparty CFLAGS += -I$(SRCDIR)/shared -I$(SRCDIR)/shared/thirdparty
CPPFLAGS := CPPFLAGS :=
LDFLAGS := LDFLAGS :=
PREFIX := /usr/local PREFIX := /usr/local
@ -55,13 +54,17 @@ ALL_LDLIBS := -lc
# Source, Binaries, Dependencies # Source, Binaries, Dependencies
SRC := $(shell find $(SRCDIR) -type f -name '*.c' | grep -v '/linux/' && find $(SHARED) -type f -name '*.c') SRC := $(shell find $(SRCDIR) -type f -name '*.c' | grep -v '/linux/' | grep -v '/server/' | grep -v '/font/' | grep -v '/retired/')
OBJ := $(patsubst $(SRCDIR)/%,$(OBJDIR)/%,$(SRC:.c=.o)) OBJ := $(patsubst $(SRCDIR)/%,$(OBJDIR)/%,$(SRC:.c=.o))
DEP := $(OBJ:.o=.d) DEP := $(OBJ:.o=.d)
BIN := $(BINDIR)/$(TARGET) BIN := $(BINDIR)/$(TARGET)
-include $(DEP) -include $(DEP)
#$(info [${SRC}])
#$(info [${OBJ}])
# Verbosity Control, ala automake # Verbosity Control, ala automake
V = 0 V = 0

View file

@ -18,26 +18,20 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# #
mkdir -p bin obj/system obj/dos obj/gui obj/thirdparty/memwatch obj/thirdparty/serial mkdir -p \
bin/data \
obj/client/src/system \
obj/client/src/dos \
obj/client/src/gui \
obj/client/src/thirdparty/serial \
obj/shared/thirdparty/memwatch \
obj/shared/thirdparty/blowfish-api \
obj/shared/thirdparty/ini/src
source /opt/cross/djgpp/setenv source /opt/cross/djgpp/setenv
make -f Makefile.djgpp make -f Makefile.djgpp
rm bin/client rm bin/client
cp data/* bin/.
:<<'SKIP' cp client/data/* bin/data/.
[[ -f bin/CLIENT.LOG ]] && rm bin/CLIENT.LOG
cat <<-'BATCH' > bin/test.bat
@echo off
:wait
if not exist flag.dat goto wait
del flag.dat
client.exe 800 600 16
BATCH
touch bin/flag.dat
while [[ ! -f bin/CLIENT.LOG ]]; do
/bin/true
done
tail -f bin/CLIENT.LOG
SKIP

View file

@ -137,15 +137,18 @@ LIBS = \
-lSDL2 -lSDL2
OTHER_FILES = \ OTHER_FILES = \
Makefile.djgpp \
$$DOS_HEADERS \ $$DOS_HEADERS \
$$DOS_SOURCES \ $$DOS_SOURCES \
build.sh \ ../Makefile.djgpp \
test.sh \ ../build.sh \
test.conf ../test.sh \
../test.conf \
postBuild.sh
testing { testing {
DEFINES *= TESTING DEFINES *= TESTING
HEADERS += src/test.h HEADERS += src/test.h
SOURCES += src/test.c SOURCES += src/test.c
} }
QMAKE_POST_LINK = $$PWD/postBuild.sh "$$PWD" "$$DESTDIR"

26
client/postBuild.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash -e
#
# Kangaroo Punch MultiPlayer Game Server Mark II
# Copyright (C) 2020-2021 Scott Duensing
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
SOURCE=$1
TARGET=$2
mkdir -p ${TARGET}/data
cp ${SOURCE}/data/* ${TARGET}/data/.

View file

@ -30,7 +30,6 @@
* - Find a light grey to replace white widget data areas * - Find a light grey to replace white widget data areas
* - No thumb in listbox scrollbar * - No thumb in listbox scrollbar
* - Layout container widgets! * - Layout container widgets!
* - DOS makefile is placing thirdparty object files in the wrong place
*/ */
@ -46,6 +45,7 @@
#include "timer.h" #include "timer.h"
#include "gui.h" #include "gui.h"
#include "config.h" #include "config.h"
#include "util.h"
#include "welcome.h" #include "welcome.h"
@ -68,7 +68,7 @@ static void taskGuiEventLoop(void *data) {
(void)data; (void)data;
pointer = imageLoad("mouse.png"); pointer = imageLoad("data/mouse.png");
alpha = imagePixelGet(pointer, 5, 0); alpha = imagePixelGet(pointer, 5, 0);
do { do {
@ -110,6 +110,11 @@ static void taskGuiEventLoop(void *data) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
#ifndef __linux__
// On DOS, display the contets of the log now that we're back in text mode.
char *logName = NULL;
FILE *in = NULL;
#endif
memoryStartup(argv[0]); memoryStartup(argv[0]);
logOpenByHandle(memoryLogHandleGet()); logOpenByHandle(memoryLogHandleGet());
@ -163,5 +168,22 @@ int main(int argc, char *argv[]) {
logClose(); logClose();
memoryShutdown(); memoryShutdown();
#ifndef __linux__
//***TODO*** Why the frack does this not work?!
textmode(C80);
// On DOS, display the contets of the log now that we're back in text mode.
logName = utilAppNameWithNewExtensionGet(argv[0], "log");
in = fopen(logName, "r");
if (in) {
while (!feof(in)) {
putc(fgetc(in), stdout);
}
fclose(in);
free(in);
}
free(logName);
_Exit(0);
#endif
return 0; return 0;
} }

View file

@ -40,8 +40,11 @@ void memoryOutput(int c) {
fputc(c, _memoryLog); fputc(c, _memoryLog);
fflush(_memoryLog); fflush(_memoryLog);
#ifdef __linux__
// Also output to stdout on Linux.
fputc(c, stdout); fputc(c, stdout);
fflush(stdout); fflush(stdout);
#endif
} }
#endif #endif

View file

@ -49,6 +49,7 @@ long biostime(int cmd, long newtime);
#include <dpmi.h> #include <dpmi.h>
#include <go32.h> #include <go32.h>
#include <bios.h> #include <bios.h>
#include <conio.h>
#include <sys/farptr.h> #include <sys/farptr.h>
#include <sys/nearptr.h> #include <sys/nearptr.h>

View file

@ -123,7 +123,7 @@ static void test(void *data) {
guiAttach(W(desktop), W(w4)); guiAttach(W(desktop), W(w4));
// Window 1 // Window 1
p1 = pictureNew(0, 0, "kanga.png"); p1 = pictureNew(0, 0, "data/kanga.png");
guiAttach(W(w1), W(p1)); guiAttach(W(w1), W(p1));
lb1 = listboxNew(155, 10, 120, 140, "List Box"); lb1 = listboxNew(155, 10, 120, 140, "List Box");
listboxItemAdd(lb1, "One"); listboxItemAdd(lb1, "One");
@ -213,7 +213,7 @@ void taskTestTagList(void *data) {
T_X, 300, T_Y, 25, T_WIDTH, 300, T_HEIGHT, 200, T_X, 300, T_Y, 25, T_WIDTH, 300, T_HEIGHT, 200,
T_PICTURE, O(p1), T_PICTURE, O(p1),
T_X, 0, T_Y, 0, T_X, 0, T_Y, 0,
T_FILENAME, P("kanga.png"), T_FILENAME, P("data/kanga.png"),
T_PICTURE, T_DONE, T_PICTURE, T_DONE,
T_LISTBOX, O(lb1), T_LISTBOX, O(lb1),
T_TITLE, P("Listbox"), T_TITLE, P("Listbox"),
@ -331,7 +331,7 @@ static void testTerminal(void *data) {
(void)data; (void)data;
// Load ANSI file for terminal test. // Load ANSI file for terminal test.
in = fopen("kanga.ans", "rt"); in = fopen("data/kanga.ans", "rt");
fseek(in, 0, SEEK_END); fseek(in, 0, SEEK_END);
length = ftell(in); length = ftell(in);
fseek(in, 0, SEEK_SET); fseek(in, 0, SEEK_SET);

View file

@ -71,7 +71,7 @@ void taskWelcome(void *data) {
T_TITLE, P("Welcome to KangaWorld!"), T_TITLE, P("Welcome to KangaWorld!"),
T_WIDTH, 500, T_HEIGHT, 225, T_WIDTH, 500, T_HEIGHT, 225,
T_PICTURE, O(picLogo), T_PICTURE, O(picLogo),
T_FILENAME, P("logo.png"), T_FILENAME, P("data/logo.png"),
T_X, 18, T_Y, 18, T_X, 18, T_Y, 18,
T_PICTURE, T_DONE, T_PICTURE, T_DONE,
T_BUTTON, O(btnQuit), T_BUTTON, O(btnQuit),

Binary file not shown.