Original author: Pierre Sarrazin. Source: http://sarrazip.com/dev/ebitor-0.1.1.tar.gz Archive SHA-256: 6911a9d2ee80925622f1d82db1b77710a1f896865e63d29a04dc16489b150e83
217 lines
5.3 KiB
Makefile
217 lines
5.3 KiB
Makefile
# By Pierre Sarrazin <http://sarrazip.com/>
|
|
#
|
|
# This file is in the public domain.
|
|
#
|
|
# To compile the demo program and the test program, do "make" or "make all".
|
|
# To make a DECB floppy disk image with those programs, do "make dsk".
|
|
#
|
|
# The OS-9 version needs the BControl library, available from the CMOC home page.
|
|
# Before building, create a symlink named 'bcontrol' that points to the
|
|
# BControl source code.
|
|
# Then to build, do "make TARGET=os9".
|
|
# To deploy to the OS-9 hard disk image designtaed by OS9_DSK, make sure that
|
|
# the "os9" command of the ToolShed package (version 2.2. or later) is in the path,
|
|
# then do "make TARGET=os9 deploy".
|
|
|
|
PACKAGE = ebitor
|
|
VERSION = 0.1.1
|
|
|
|
TARGET = coco
|
|
|
|
# Sources and headers of the library.
|
|
CORELIBSRC = \
|
|
Ebitor.c \
|
|
findStringAndScrollToShow.c \
|
|
processPrintableChar.c \
|
|
processBackspace.c \
|
|
scrollToShowLogicalOffset.c
|
|
COCOLIBSRC = sg4term.c gimeterm.c
|
|
OS9LIBSRC = os9term.c
|
|
LIBSRC = $(CORELIBSRC)
|
|
CORELIBHEADERS = \
|
|
Ebitor.h \
|
|
Ebitor_private.h \
|
|
Window.h
|
|
COCOLIBHEADERS = sg4term.h gimeterm.h
|
|
OS9LIBHEADERS = os9term.h
|
|
LIBHEADERS = $(CORELIBHEADERS)
|
|
|
|
# Add platform-specific sources and headers.
|
|
ifeq "$(TARGET)" "coco"
|
|
LIBSRC += $(COCOLIBSRC)
|
|
LIBHEADERS += $(COCOLIBHEADERS)
|
|
else ifeq "$(TARGET)" "os9"
|
|
LIBSRC += $(OS9LIBSRC)
|
|
LIBHEADERS += $(OS9LIBHEADERS)
|
|
else ifeq "$(TARGET)" "usim"
|
|
LIBSRC += $(COCOLIBSRC)
|
|
LIBHEADERS += $(COCOLIBHEADERS)
|
|
endif
|
|
|
|
STATICLIB = lib$(PACKAGE).a
|
|
|
|
ifeq "$(TARGET)" "coco"
|
|
EXEEXT = .bin
|
|
else ifeq "$(TARGET)" "usim"
|
|
EXEEXT = .srec
|
|
else ifeq "$(TARGET)" "os9"
|
|
EXEEXT =
|
|
endif
|
|
|
|
# Interactive demo program where the user can use the editor.
|
|
ifneq "$(TARGET)" "usim"
|
|
DEMOSRC = ebitdemo.c
|
|
DEMOBIN = ebitdemo$(EXEEXT)
|
|
endif
|
|
|
|
ifeq "$(TARGET)" "coco"
|
|
|
|
# Minimal interactive demo that only runs in 32x16 under DECB.
|
|
SMOLDEMOSRC = smoldemo.c
|
|
SMOLDEMOBIN = smoldemo$(EXEEXT)
|
|
|
|
endif
|
|
|
|
ifneq "$(TARGET)" "os9"
|
|
|
|
# Non-interactive self-test suite (uses sg4term.c).
|
|
TESTSRC = ebittest.c
|
|
TESTBIN = ebittest$(EXEEXT)
|
|
|
|
endif
|
|
|
|
# List of sources and headers across all supported platforms.
|
|
DISTLIBSRC = $(CORELIBSRC) $(COCOLIBSRC) $(OS9LIBSRC)
|
|
DISTLIBHEADERS = $(CORELIBHEADERS) $(COCOLIBHEADERS) $(OS9LIBHEADERS)
|
|
DISTFILES = README.md Makefile $(DISTLIBHEADERS) $(DISTLIBSRC) $(DEMOSRC) $(SMOLDEMOSRC) $(TESTSRC)
|
|
|
|
|
|
DSK = $(PACKAGE)-$(VERSION)-$(TARGET).dsk
|
|
|
|
# Compilation and linking flags. Left empty under OS-9.
|
|
# With no --org option, the DECB .bin entry point is $2800.
|
|
ifneq "$(TARGET)" "os9"
|
|
DEMOORG = --limit=7F00
|
|
SMOLDEMOORG = --limit=7F00
|
|
TESTORG = --limit=7F00
|
|
endif
|
|
INTERMEDIATE = #--intermediate
|
|
|
|
# Omit -DNDEBUG to enable the assert statements in the library.
|
|
NDEBUG = -DNDEBUG
|
|
|
|
OPTIM = -fomit-frame-pointer
|
|
WARNINGS = -Wfor-condition-sizes #-Wgives-byte
|
|
WERROR = -Werror #-Wno-uncalled-static
|
|
STACKSPACE = 2048
|
|
CFLAGS = --$(TARGET) $(NDEBUG) $(INTERMEDIATE) $(OPTIM) $(WARNINGS) $(WERROR) \
|
|
-DVERSION=\"$(VERSION)\" --stack-space=$(STACKSPACE)
|
|
LDFLAGS = --$(TARGET) $(INTERMEDIATE)
|
|
|
|
|
|
DEMOOBJ = $(DEMOSRC:.c=.o)
|
|
SMOLDEMOOBJ = $(SMOLDEMOSRC:.c=.o)
|
|
TESTOBJ = $(TESTSRC:.c=.o)
|
|
LIBOBJ = $(LIBSRC:.c=.o)
|
|
|
|
# Libraries possibly needed by this package.
|
|
ifeq "$(TARGET)" "os9"
|
|
BCONTROL_LIB = bcontrol
|
|
BCONTROL_LIB_DIR = bcontrol
|
|
DEMO_CFLAGS = -I $(BCONTROL_LIB_DIR)
|
|
DEMO_LDFLAGS = -L $(BCONTROL_LIB_DIR) -l$(BCONTROL_LIB)
|
|
endif
|
|
|
|
# Tools.
|
|
CMOC = cmoc
|
|
LWAR = lwar
|
|
PERL = perl
|
|
TAR = tar
|
|
WRITECOCOFILE = writecocofile
|
|
INSTALL_LOADER = install-coco-boot-loader
|
|
XROAR = xroar
|
|
|
|
all: $(DEMOBIN) $(SMOLDEMOBIN) $(TESTBIN)
|
|
|
|
$(DEMOBIN): $(DEMOOBJ) $(STATICLIB)
|
|
$(CMOC) -o $(DEMOBIN) $(LDFLAGS) $(DEMOORG) $(DEMOOBJ) -L. -l$(PACKAGE) $(DEMO_LDFLAGS)
|
|
|
|
ifeq "$(TARGET)" "coco"
|
|
|
|
$(SMOLDEMOBIN): $(SMOLDEMOOBJ) $(STATICLIB)
|
|
$(CMOC) -o $(SMOLDEMOBIN) $(LDFLAGS) $(SMOLDEMOORG) $(SMOLDEMOOBJ) -L. -l$(PACKAGE)
|
|
|
|
endif
|
|
|
|
ifneq "$(TARGET)" "os9"
|
|
|
|
$(TESTBIN): $(TESTOBJ) $(STATICLIB)
|
|
$(CMOC) -o $(TESTBIN) $(LDFLAGS) $(TESTORG) $(TESTOBJ) -L. -l$(PACKAGE)
|
|
|
|
endif
|
|
|
|
$(STATICLIB): $(LIBOBJ)
|
|
$(LWAR) --create $(STATICLIB) $(LIBOBJ)
|
|
|
|
ifeq "$(TARGET)" "coco"
|
|
|
|
$(DSK): dsk
|
|
|
|
.PHONY: dsk
|
|
dsk: $(DEMOBIN) $(SMOLDEMOBIN) $(TESTBIN)
|
|
$(PERL) -e 'print chr(255) x (35*18*256)' > $(DSK)
|
|
$(WRITECOCOFILE) $(DSK) $(DEMOBIN)
|
|
$(WRITECOCOFILE) $(DSK) $(SMOLDEMOBIN)
|
|
$(WRITECOCOFILE) $(DSK) $(TESTBIN)
|
|
|
|
endif
|
|
|
|
ifeq "$(TARGET)" "os9"
|
|
OS9_DSK = 68sdc.vhd
|
|
OS9COPY = os9 copy
|
|
OS9ATTR = os9 attr -q
|
|
|
|
.PHONY: deploy
|
|
deploy: $(DEMOBIN)
|
|
$(OS9COPY) $(DEMOBIN) $(OS9_DSK),CMDS -r
|
|
$(OS9ATTR) -epe $(OS9_DSK),CMDS/$(DEMOBIN)
|
|
endif
|
|
|
|
%.o: %.c
|
|
$(CMOC) -c $(CFLAGS) $(DEMO_CFLAGS) -o $@ $<
|
|
|
|
clean:
|
|
rm -f $(DEMOBIN) $(DEMOOBJ) \
|
|
$(SMOLDEMOBIN) $(SMOLDEMOOBJ) \
|
|
$(TESTBIN) $(TESTOBJ) \
|
|
$(STATICLIB) $(LIBOBJ)
|
|
|
|
distclean: clean
|
|
rm -f $(DEMOSRC:.c=.d) $(SMOLDEMOSRC:.c=.d) $(LIBSRC:.c=.d)
|
|
|
|
.PHONY: dist distcheck
|
|
dist:
|
|
$(TAR) -czf $(PACKAGE)-$(VERSION).tar.gz --transform 's,^,$(PACKAGE)-$(VERSION)/,' $(DISTFILES)
|
|
|
|
# To do a distcheck with TARGET=os9, also pass BCONTROL_LIB_DIR=FIXME.
|
|
#
|
|
distcheck: dist
|
|
mkdir ,distcheck
|
|
$(TAR) -C ,distcheck -xzf $(PACKAGE)-$(VERSION).tar.gz
|
|
$(MAKE) -C ,distcheck/$(PACKAGE)-$(VERSION) all dsk
|
|
rm -fr ,distcheck
|
|
@echo "SUCCESS: $(PACKAGE)-$(VERSION).tar.gz ready for distribution"
|
|
|
|
# Automatic prerequisite generation.
|
|
%.d: %.c
|
|
$(CMOC) --deps-only $(CFLAGS) $(DEMO_CFLAGS) $<
|
|
|
|
.PHONY: cleandeps
|
|
cleandeps:
|
|
rm -f $(DEMOSRC:.c=.d) $(SMOLDEMOSRC:.c=.d) $(TESTSRC:.c=.d) $(LIBSRC:.c=.d)
|
|
|
|
include $(DEMOSRC:.c=.d)
|
|
include $(SMOLDEMOSRC:.c=.d)
|
|
include $(TESTSRC:.c=.d)
|
|
include $(LIBSRC:.c=.d)
|