Skip to content

Commit

Permalink
Merge pull request #18 from mike632t/stable
Browse files Browse the repository at this point in the history
Added a make file
  • Loading branch information
davidly authored Feb 11, 2025
2 parents c5eb3ca + cbbe8ef commit 4439064
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 1 deletion.
82 changes: 82 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#
# makefile - NT Virtual CP/M Machine.
#
# License CC0 1.0 Universal
#
# 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
#
# Usage:
#
# 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
# make backup - Backup files
#

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 != printf "%04d" $(shell git rev-list --count HEAD 2> /dev/null)
UNAME != uname
CC = g++

LIBS =
LFLAGS = -static
CFLAGS = -ggdb -fno-builtin -I .

ifndef VERBOSE
VERBOSE = 0
endif

ifneq ($(COMMIT),)
CFLAGS += -DCOMMIT_ID='" [Commit Id: $(COMMIT)]"'
endif

ifneq ($(BUILD),)
CFLAGS += -DBUILD='".$(BUILD)"'
endif

all: CFLAGS += -flto -Ofast -D NDEBUG
all: $(PROGRAM) $(OBJECTS)

$(PROGRAM): $(OBJECTS)
ifneq ($(VERBOSE),0)
@echo
@echo $(CC) $(LFLAGS) $(OBJECTS) -o $@ $(LIBS)
@echo
endif
@$(CC) $(LFLAGS) $(OBJECTS) -o $@ $(LIBS)
@ls --color $@

$(OBJECTS) : $(SOURCES)
ifneq ($(VERBOSE),0)
@echo
@echo $(CC) $(CFLAGS) -c $(SOURCES)
endif
@$(CC) $(CFLAGS) -c $(SOURCES)

release: clean
release: all

debug: clean
debug: CFLAGS += -Og -D DEBUG
debug: $(PROGRAM)

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)
6 changes: 5 additions & 1 deletion ntvcm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <djl_con.hxx>
#include <djl_cycle.hxx>

#define AUTHOR "David Lee"
#define FILENAME "ntvcm"
#define VERSION "0.1"
#if !defined(BUILD)
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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 <https://creativecommons.org/publicdomain/zero/1.0/>.\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;
Expand Down

0 comments on commit 4439064

Please sign in to comment.