Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a make file #18

Merged
merged 7 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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