From 59543bd9ce91ba546d55fb9bd1a0c88934fc8ba2 Mon Sep 17 00:00:00 2001
From: mike632t <1799044+mike632t@users.noreply.github.com>
Date: Sun, 9 Feb 2025 00:13:59 +0000
Subject: [PATCH 1/7] Added a make file
---
makefile | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
create mode 100644 makefile
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..457e3ae
--- /dev/null
+++ b/makefile
@@ -0,0 +1,80 @@
+#
+# makefile - NT Virtual CP/M Machine.
+#
+# Copyright(C) 2022 - David Lee/MT
+#
+# 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 .
+#
+# Note separator (tab) at the beginning of the line CANNOT be a space..!
+#
+# https://stackoverflow.com/questions/1079832/
+#
+# 08 Feb 25 0.1 - Initial version - MT
+# - Added the ability to create debug code using target-
+# specific variable values - MT
+#
+
+PROJECT = gcc-ntvcm
+PROGRAM = ntvcm
+SOURCES = ntvcm.cxx x80.cxx
+FILES = *.cxx *.hxx LICENSE README.md makefile *.md .gitignore #.gitattributes
+OBJECTS = $(SOURCES:.cxx=.o)
+OUTPUT = $(PROGRAM).out
+LANG = LANG_$(shell (echo $$LANG | cut -f 1 -d '_'))
+COMMIT != git log -1 HEAD --format=%h 2> /dev/null
+#BUILD != git rev-list --count HEAD 2> /dev/null
+BUILD != printf "%04d" $(shell git rev-list --count HEAD 2> /dev/null)
+UNAME = $(shell uname)
+CC = g++
+
+LIBS =
+LFLAGS = -static
+CFLAGS = -ggdb -Ofast -fno-builtin -I .
+CFLAGS += -Wno-comment -Wno-deprecated-declarations -Wno-builtin-macro-redefined
+
+ifneq ($(COMMIT),)
+CFLAGS += -DCOMMIT_ID='" [Commit Id : $(COMMIT)]"'
+endif
+
+ifneq ($(BUILD),)
+CFLAGS += -DBUILD='".$(BUILD)"'
+endif
+
+all: clean $(PROGRAM) $(OBJECTS)
+
+$(PROGRAM): $(OBJECTS)
+ifdef VERBOSE
+ @echo
+ @echo $(CC) $(LFLAGS) $(OBJECTS) -o $@ $(LIBS)
+ @echo
+endif
+ @$(CC) $(LFLAGS) $(OBJECTS) -o $@ $(LIBS)
+ @ls --color $@
+
+$(OBJECTS) : $(SOURCES)
+ifdef VERBOSE
+ @echo
+ @echo $(CC) $(CFLAGS) -c $(SOURCES)
+endif
+ @$(CC) $(CFLAGS) -c $(SOURCES)
+
+debug: CFLAGS += -g -DDEBUG
+debug: all
+
+clean:
+ @rm -f $(PROGRAM) # -v
+ @rm -f $(OBJECTS) # -v
+
+backup: clean
+ @echo "$(PROJECT)-`date +'%Y%m%d%H%M'`.tar.gz"; tar -czpf ..\/$(PROJECT)-`date +'%Y%m%d%H%M'`.tar.gz $(FILES)
From d3cb1337587f28dafec8a6237dd28c0f7f72a49e Mon Sep 17 00:00:00 2001
From: mike632t <1799044+mike632t@users.noreply.github.com>
Date: Mon, 10 Feb 2025 23:11:29 +0000
Subject: [PATCH 2/7] Build type determined by DEBUG not NDEBUG - allows
makefile to test just DEBUG
---
djl_os.hxx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/djl_os.hxx b/djl_os.hxx
index b3bd4bc..189bbe1 100644
--- a/djl_os.hxx
+++ b/djl_os.hxx
@@ -200,10 +200,10 @@ inline const char * target_platform()
inline const char * build_type()
{
- #ifdef NDEBUG
- return "release";
- #else
+ #ifdef DEBUG
return "debug";
+ #else
+ return "release";
#endif
} //build_type
From 50b6d0826c0f0b340f0bb26636e5872f1b3b8125 Mon Sep 17 00:00:00 2001
From: mike632t <1799044+mike632t@users.noreply.github.com>
Date: Mon, 10 Feb 2025 23:31:35 +0000
Subject: [PATCH 3/7] Added licence description to version information.
---
ntvcm.cxx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ntvcm.cxx b/ntvcm.cxx
index 4ad9358..776cb09 100644
--- a/ntvcm.cxx
+++ b/ntvcm.cxx
@@ -45,6 +45,7 @@
#include
#include
+#define AUTHOR "David Lee"
#define FILENAME "ntvcm"
#define VERSION "0.1"
#if !defined(BUILD)
@@ -2914,7 +2915,6 @@ void version() // Display version information
printf( "0%c %c%c%c %s %s\n", __DATE__[5], __DATE__[0], __DATE__[1], __DATE__[2], &__DATE__[7], __TIME__ );
else
printf( "%c%c %c%c%c %s %s\n", __DATE__[4], __DATE__[5], __DATE__[0], __DATE__[1], __DATE__[2], &__DATE__[7], __TIME__ );
- exit( 0 );
} // version
void error( char const * perr = 0 )
@@ -3068,7 +3068,11 @@ int main( int argc, char * argv[] )
char ca = (char)( parg[1] );
if ( 'V' == ca )
+ {
version();
+ printf("License CC0 1.0 Universal: See .\n");
+ exit(0);
+ }
#if defined( _WIN32 ) // Windows only
else if ( 'C' == parg[1] ) // MT - moved other wise option would be converted to lower case before it was tested
force80x24 = true;
From 379c01347991cf0471996d3290ecd20db7945299 Mon Sep 17 00:00:00 2001
From: mike632t <1799044+mike632t@users.noreply.github.com>
Date: Mon, 10 Feb 2025 23:31:57 +0000
Subject: [PATCH 4/7] Added makefile (depends on make and g++)
---
makefile | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/makefile b/makefile
index 457e3ae..e7dda9a 100644
--- a/makefile
+++ b/makefile
@@ -24,6 +24,15 @@
# - Added the ability to create debug code using target-
# specific variable values - MT
#
+# Usage:
+#
+# make - Rebuild application using release flags.
+# make all
+# make debug - Rebuild application using debug flags.
+# make clean - Deletes object files
+# make VERBOSE=1 - Verbose output
+# make backup - Backup files
+#
PROJECT = gcc-ntvcm
PROGRAM = ntvcm
@@ -33,28 +42,32 @@ OBJECTS = $(SOURCES:.cxx=.o)
OUTPUT = $(PROGRAM).out
LANG = LANG_$(shell (echo $$LANG | cut -f 1 -d '_'))
COMMIT != git log -1 HEAD --format=%h 2> /dev/null
-#BUILD != git rev-list --count HEAD 2> /dev/null
BUILD != printf "%04d" $(shell git rev-list --count HEAD 2> /dev/null)
-UNAME = $(shell uname)
+UNAME != uname
CC = g++
LIBS =
LFLAGS = -static
-CFLAGS = -ggdb -Ofast -fno-builtin -I .
-CFLAGS += -Wno-comment -Wno-deprecated-declarations -Wno-builtin-macro-redefined
+CFLAGS = -ggdb -fno-builtin -I .
+
+ifndef VERBOSE
+VERBOSE = 0
+endif
ifneq ($(COMMIT),)
-CFLAGS += -DCOMMIT_ID='" [Commit Id : $(COMMIT)]"'
+CFLAGS += -DCOMMIT_ID='" [Commit Id: $(COMMIT)]"'
endif
ifneq ($(BUILD),)
CFLAGS += -DBUILD='".$(BUILD)"'
endif
-all: clean $(PROGRAM) $(OBJECTS)
+all: clean
+all: CFLAGS += -flto -Ofast
+all: $(PROGRAM) $(OBJECTS)
$(PROGRAM): $(OBJECTS)
-ifdef VERBOSE
+ifneq ($(VERBOSE),0)
@echo
@echo $(CC) $(LFLAGS) $(OBJECTS) -o $@ $(LIBS)
@echo
@@ -63,17 +76,18 @@ endif
@ls --color $@
$(OBJECTS) : $(SOURCES)
-ifdef VERBOSE
+ifneq ($(VERBOSE),0)
@echo
@echo $(CC) $(CFLAGS) -c $(SOURCES)
endif
@$(CC) $(CFLAGS) -c $(SOURCES)
-debug: CFLAGS += -g -DDEBUG
-debug: all
+debug: clean
+debug: CFLAGS += -Og -D DEBUG
+debug: $(PROGRAM)
clean:
- @rm -f $(PROGRAM) # -v
+# @rm -f $(PROGRAM) # -v
@rm -f $(OBJECTS) # -v
backup: clean
From 8c62045832e3cd8b1f9dca3fa8a5f514e866edde Mon Sep 17 00:00:00 2001
From: mike632t <1799044+mike632t@users.noreply.github.com>
Date: Mon, 10 Feb 2025 23:41:46 +0000
Subject: [PATCH 5/7] Updated licence in makefile
---
makefile | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/makefile b/makefile
index e7dda9a..4d57249 100644
--- a/makefile
+++ b/makefile
@@ -1,22 +1,7 @@
#
# makefile - NT Virtual CP/M Machine.
#
-# Copyright(C) 2022 - David Lee/MT
-#
-# 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 .
-#
-# Note separator (tab) at the beginning of the line CANNOT be a space..!
+# License CC0 1.0 Universal
#
# https://stackoverflow.com/questions/1079832/
#
From bf859c617642573b446713bd430ec38ab6391ed1 Mon Sep 17 00:00:00 2001
From: mike632t <1799044+mike632t@users.noreply.github.com>
Date: Tue, 11 Feb 2025 08:46:40 +0000
Subject: [PATCH 6/7] Revert "Build type determined by DEBUG not NDEBUG -
allows makefile to test just DEBUG"
This reverts commit d3cb1337587f28dafec8a6237dd28c0f7f72a49e.
---
djl_os.hxx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/djl_os.hxx b/djl_os.hxx
index 189bbe1..b3bd4bc 100644
--- a/djl_os.hxx
+++ b/djl_os.hxx
@@ -200,10 +200,10 @@ inline const char * target_platform()
inline const char * build_type()
{
- #ifdef DEBUG
- return "debug";
+ #ifdef NDEBUG
+ return "release";
#else
- return "release";
+ return "debug";
#endif
} //build_type
From cbbe8eff7836c10109854f696054d94410304f4c Mon Sep 17 00:00:00 2001
From: mike632t <1799044+mike632t@users.noreply.github.com>
Date: Tue, 11 Feb 2025 08:59:44 +0000
Subject: [PATCH 7/7] Release builds set NDEBUG
---
makefile | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/makefile b/makefile
index 4d57249..2aa27e0 100644
--- a/makefile
+++ b/makefile
@@ -11,8 +11,9 @@
#
# Usage:
#
-# make - Rebuild application using release flags.
+# make - Incremental make.
# make all
+# make release - Rebuild application using release flags.
# make debug - Rebuild application using debug flags.
# make clean - Deletes object files
# make VERBOSE=1 - Verbose output
@@ -47,8 +48,7 @@ ifneq ($(BUILD),)
CFLAGS += -DBUILD='".$(BUILD)"'
endif
-all: clean
-all: CFLAGS += -flto -Ofast
+all: CFLAGS += -flto -Ofast -D NDEBUG
all: $(PROGRAM) $(OBJECTS)
$(PROGRAM): $(OBJECTS)
@@ -67,8 +67,11 @@ ifneq ($(VERBOSE),0)
endif
@$(CC) $(CFLAGS) -c $(SOURCES)
+release: clean
+release: all
+
debug: clean
-debug: CFLAGS += -Og -D DEBUG
+debug: CFLAGS += -Og -D DEBUG
debug: $(PROGRAM)
clean: