From 1958fa1fad4c10da5e14141b0db14df1f6906a30 Mon Sep 17 00:00:00 2001 From: Olaf Seibert Date: Wed, 11 Mar 2020 21:16:08 +0100 Subject: [PATCH] Make default object file format choosable from Makefile. --- Makefile | 3 ++- dumpobj.c | 6 +++++- macro11.c | 6 ++++-- object.c | 6 +++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0ad4bf5..73662dd 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,8 @@ # WARNS ?= -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow -CFLAGS ?= -O -ggdb -std=gnu99 $(WARNS) +OBJFORMAT = -DDEFAULT_OBJECTFORMAT_RT11=0 +CFLAGS ?= -O -ggdb -std=gnu99 $(WARNS) $(OBJFORMAT) MACRO11_SRCS = macro11.c \ assemble.c assemble_globals.c assemble_aux.c \ diff --git a/dumpobj.c b/dumpobj.c index d947e72..f377408 100644 --- a/dumpobj.c +++ b/dumpobj.c @@ -49,6 +49,10 @@ DAMAGE. #define NPSECTS 256 +#ifndef DEFAULT_OBJECTFORMAT_RT11 +#define DEFAULT_OBJECTFORMAT_RT11 0 +#endif + int psectid = 0; char *psects[NPSECTS]; FILE *bin = NULL; @@ -686,7 +690,7 @@ int main( int len; FILE *fp; int arg; - int rt11 = 0; + int rt11 = DEFAULT_OBJECTFORMAT_RT11; char *infile = 0; char *outfile = 0; diff --git a/macro11.c b/macro11.c index 981d137..112946b 100644 --- a/macro11.c +++ b/macro11.c @@ -145,8 +145,10 @@ static void print_help( printf(" libraries (see -m) into individual .MAC files in the current\n"); printf(" directory. No assembly of input is done.\n"); printf(" This must be the last command line option!\n"); - printf("-rsx Generate RSX style object files (default).\n"); - printf("-rt11 Generate RT11 style object files.\n"); + printf("-rsx Generate RSX style object files%s.\n", + (rt11 ? "": " (default)")); + printf("-rt11 Generate RT11 style object files.%s\n", + (rt11 ? " (default)": "")); printf("-ysl Syntax extension: change length of symbols from \n"); printf(" default = %d to larger values, max %d.\n", SYMMAX_DEFAULT, SYMMAX_MAX); printf("-yus Syntax extension: allow underscore \"_\" in symbols.\n"); diff --git a/object.c b/object.c index b6cbb27..1e76355 100644 --- a/object.c +++ b/object.c @@ -47,7 +47,11 @@ DAMAGE. #include "rad50.h" #include "object.h" -int rt11 = 0; +#ifndef DEFAULT_OBJECTFORMAT_RT11 +#define DEFAULT_OBJECTFORMAT_RT11 0 +#endif + +int rt11 = DEFAULT_OBJECTFORMAT_RT11; /* writerec writes "formatted binary records."