Timothe Litt 3f193e6f99 Baselevel commit for V2.99
Reorganize commands into separate modules - ods2.c was way too big.
This reduces it from around 3000 LOC to less than 1K LOC.

Reorder I/O so PHYVIRT mediates all physical access.

Fix memory leaks of device structures.

Reorganize Files-11 vs. internal structures.

Allow more granular control of DEBUG from the makefile.

Show VOLUME handles free space and tries to match geometry from SCB to known disk types.

Fix many compilation warnings.

Add code to allow dumping disk data for debug.

Automatically generate descrip.mms from dependencies.

Correctly handle directory default version limit; previously confused with file version limit.

Teach help to sort tables for presentation; manually keeping them sorted is problematic,
and code maintenance prefers functional groupings.

Add the ability to initialize a Files-11 volume. (Not quite complete.)

Add dependency generation to makefiles.  Excludes system headers so
makedepends isn't required to build.

Simplify makefiles to use more recipes.

Teach makefiles to list all sources and headers so it's easier to keep git and MSVC up-to-date.

Add support for accessing images of disks with interleave/skew/offsets (e.g. RX02).

Add VHD support, including ability to create a snapshot with mount/write.

Teach RMS to handle NOSPAN variable length records correctly.

Fix RMS GET handling of variable length records with VFC that span block boundaries.

Fix delete file (a day-one incomplete).   Still some cases to validate.

 Purge cache of modified blocks at rundown and at the end of each command.

Do not allow deletion of reserved files.

Move revision history to version.h

Correct various permissions in git.
2016-03-23 16:53:27 -04:00

136 lines
3.6 KiB
Makefile

# -*- Makefile -*-
# Generic makefile for ods2
#
# This tries really hard to be OS-agnostic, because
# otherwise, every little change means updating all
# the os-specific makefiles.
#
# See makefile.<osname>, which normally includes it
#
# If your make doesn't support include, these can be
# specified manually, for example:
# make CC=gcc "CCFLAGS=-O4 -f" OBJ=.o \
# PHYSIO=phyunix DEFS=-DUSE_READLINE LDFLAGS=-lreadline
#
# or just combine the files you need with an editor.
#
# ###
# OS-Specific defines
# These variables are available
# Other defines = "-DDEBUG_BUILD" "-D_FILE_OFFSET_BITS=32"
#DEFS =
# Libraries, e.g. -lreadline
#LDLIBS =
# Linker flags
#LDFLAGS =
# Object file suffix
#OBJ = .o
# Executable file suffix
#EXE =
# Physical IO module
#PHYSIO = phyunix
# Extra physical IO headers
#PHYSIOH =
# VHD format options
include $(VHDOPTS)
# #####################################################
DEPENDS = makefile.depends
MAKEDEPEND = makedepend
SED = sed
all : ods2$(EXE)
SRCS = ods2.c \
access.c \
cache.c \
compat.c \
copycmd.c \
createcmd.c \
debug.c \
deletecmd.c \
device.c \
diffcmd.c \
dircmd.c \
direct.c \
dismountcmd.c \
extendcmd.c \
helpcmd.c \
importcmd.c \
initialcmd.c \
initvol.c \
mountcmd.c \
$(PHYSIO).c \
phyvirt.c \
rms.c \
searchcmd.c \
setcmd.c \
showcmd.c \
spawncmd.c \
sysmsg.c \
typecmd.c \
update.c \
vmstime.c \
$(VHDLIB)
OBJS = $(SRCS:.c=$(OBJ))
depend: $(MAKEFILE_LIST)
$(DELETE) $(DEPENDS)
$(MAKE) -f $(TOPMAKE) $(DEPENDS)
$(MAKE) -f makefile.vms descrip.mms
# Used to list sourcefiles for updating VC project & git repository.
# Not used for Makefile builds
# Run after make depends
# To get the Windows file list on Unix, use
# make -f makefile.nt "DELETE=rm -f" depend vclist
vclist:
@echo "** Header files **"
@$(SED) $(DEPENDS) -e'/ *#/d' -e's/^.*.$(OBJ): //g' -e's/ /\n/g' | sort | uniq
@echo ""
@echo "** Source files **"
@echo $(SRCS) | sed -e's/ */\n/g' | sort | uniq
# This processing is so the kit can contain a generic, up-to-date depends file
# I don't want to require makedepend for people to build from source.
# I do want the file to be accurate when shipped, so auto-maintained.
# makedepend will include all the system library includes, which is not
# helpful for this case. So the sed processing removes dependencies that
# start with "/" - e.g. /usr/include and friends.
$(DEPENDS): $(MAKEFILE_LIST)
touch $(DEPENDS)
2>/dev/null $(MAKEDEPEND) -o$(OBJ) -I. -f- -- $(CFLAGS) $(CPPFLAGS) $(DEFS) -- $(SRCS) | $(SED) -e's/ \/[^ ]*\.h/ /g' -e'/^[^:]*: *$$/d' -e's/ */ /g' >$(DEPENDS)
-include $(DEPENDS)
# Currently, the descrip.mms file is updated on Unix. A makefile.vms
# exists solely to enable this. It might be possible to build ODS2
# on VMS with it using GNU tools. But that's not the point.
descrip.mms : $(SRCS) $(DEPENDS)
$(SED) -i.bak -e's!^OBJS = .*$$!OBJS = $(SRCS:.c=)!' -e'/^# ### BEGIN RULES ###/,$$d' -e'/^OBJS =/y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' descrip.mms
echo "# ### BEGIN RULES ###" >>descrip.mms
2>/dev/null $(MAKEDEPEND) -o$(OBJ) -I. -f- -- $(CFLAGS) $(CPPFLAGS) $(DEFS) -- $(SRCS) | $(SED) -e's/ \/[^ ]*\.h/ /g' -e'/^[^:]*: *$$/d' -e's/ */ /g' | $(SED) -e'/^# DO NOT DELETE/d' -e's/^\([^:]*\)$(OBJ):/\1$$(OBJ):/g' -e'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' >>descrip.mms
%$(OBJ): %.c
$(CC) -c $(CCFLAGS) $(CPPFLAGS) $(DEFS) $< -o $@
ods2$(EXE) : $(OBJS) $(LIBS)
$(CC) $(LDFLAGS) -o ods2$(EXE) $(OBJS) $(LDLIBS)