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
*.o
client/bin/
client/obj/
client/retired/
bin/
obj/
retired/

View file

@ -26,16 +26,15 @@ DEBUG = -g
## CHANGE THIS ##
TARGET = client
SRCDIR = src
SHARED = ../shared
SRCDIR = .
OBJDIR = obj
BINDIR = bin
## CHANGE THIS ##
# CFLAGS, LDFLAGS, CPPFLAGS, PREFIX can be overriden on CLI
CFLAGS := $(DEBUG)
CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/system -I$(SRCDIR)/dos -I$(SRCDIR)/gui -I$(SRCDIR)/thirdparty
CFLAGS += -I$(SHARED) -I$(SHARED)/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$(SRCDIR)/shared -I$(SRCDIR)/shared/thirdparty
CPPFLAGS :=
LDFLAGS :=
PREFIX := /usr/local
@ -55,13 +54,17 @@ ALL_LDLIBS := -lc
# 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))
DEP := $(OBJ:.o=.d)
BIN := $(BINDIR)/$(TARGET)
-include $(DEP)
#$(info [${SRC}])
#$(info [${OBJ}])
# Verbosity Control, ala automake
V = 0

View file

@ -18,26 +18,20 @@
# 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
make -f Makefile.djgpp
rm bin/client
cp data/* bin/.
:<<'SKIP'
[[ -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
cp client/data/* bin/data/.

View file

@ -137,15 +137,18 @@ LIBS = \
-lSDL2
OTHER_FILES = \
Makefile.djgpp \
$$DOS_HEADERS \
$$DOS_SOURCES \
build.sh \
test.sh \
test.conf
../Makefile.djgpp \
../build.sh \
../test.sh \
../test.conf \
postBuild.sh
testing {
DEFINES *= TESTING
HEADERS += src/test.h
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
* - No thumb in listbox scrollbar
* - Layout container widgets!
* - DOS makefile is placing thirdparty object files in the wrong place
*/
@ -46,6 +45,7 @@
#include "timer.h"
#include "gui.h"
#include "config.h"
#include "util.h"
#include "welcome.h"
@ -68,7 +68,7 @@ static void taskGuiEventLoop(void *data) {
(void)data;
pointer = imageLoad("mouse.png");
pointer = imageLoad("data/mouse.png");
alpha = imagePixelGet(pointer, 5, 0);
do {
@ -110,6 +110,11 @@ static void taskGuiEventLoop(void *data) {
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]);
logOpenByHandle(memoryLogHandleGet());
@ -163,5 +168,22 @@ int main(int argc, char *argv[]) {
logClose();
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;
}

View file

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

View file

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

View file

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

View file

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

Binary file not shown.