# -*- Makefile -*- for gettext-runtime/libasprintf on VMS using the MMS utility

#### Start of system configuration section. ####

# Directories used by "make install":
prefix = SYS$DATA:[
exec_prefix = $(prefix)
datadir = $(prefix).share
bindir = $(exec_prefix).bin
libdir = $(exec_prefix).lib
includedir = $(prefix).include
# For this subpackage only.
sub_docdir = $(datadir).doc.libasprintf

# Programs used by "make":

CC = cc
CXX = cxx

# These flags affect binary compatibility. GNU gettext does not need them,
# but other packages do, and we need to be binary compatible with them.
ABIFLAGS = /name=(as_is,short) /float=ieee

WARN_CFLAGS = /warning

OPTIMFLAGS = /optimize

CFLAGS = $(ABIFLAGS) $(WARN_CFLAGS) $(OPTIMFLAGS)
CXXFLAGS = $(ABIFLAGS) $(WARN_CFLAGS) $(OPTIMFLAGS)
DEFS = "VMS=1","HAVE_CONFIG_H=1"

INCLUDES = /include=([])

AR = library
AR_FLAGS = /create

LN = copy
RM = delete

# Programs used by "make install":
INSTALL = copy
INSTALL_PROGRAM = copy
INSTALL_DATA = copy

#### End of system configuration section. ####

OBJECTS = lib-asprintf.obj,autosprintf.obj

all : autosprintf.h,asprintf.olb
	write sys$output "Nothing else to be done for 'all'."

autosprintf.h :
	if f$search("autosprintf.h_in") .nes. "" then $(LN) autosprintf.h_in autosprintf.h
	if f$search("autosprintf.h_in") .eqs. "" then $(LN) autosprintf.h.in autosprintf.h

config.h : config.h_vms
	$(LN) config.h_vms config.h

alloca.h : alloca_.h
	$(LN) alloca_.h alloca.h

lib-asprintf.obj : lib-asprintf.c,config.h,printf-args.h,printf-args.c,printf-parse.h,printf-parse.c,alloca.h,vasnprintf.h,vasnprintf.c,asnprintf.c,vasprintf.h,vasprintf.c,asprintf.c
	$(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) lib-asprintf.c

autosprintf.obj : autosprintf.cc,autosprintf.h,config.h,lib-asprintf.h
	$(CXX) $(INCLUDES) $(CXXFLAGS) /define=($(DEFS)) autosprintf.cc

asprintf.olb : $(OBJECTS)
	$(AR) $(AR_FLAGS) asprintf.olb $(OBJECTS)

install : all
	create /directory $(prefix)]
	create /directory $(includedir)]
	$(INSTALL_DATA) autosprintf.h $(includedir)]autosprintf.h
	create /directory $(exec_prefix)]
	create /directory $(libdir)]
	$(INSTALL_DATA) asprintf.olb $(libdir)]asprintf.olb
	create /directory $(datadir)]
	create /directory $(datadir).doc]
	create /directory $(sub_docdir)]
	$(INSTALL_DATA) [.doc]autosprintf.html $(sub_docdir)]autosprintf.html

installdirs :
	create /directory $(prefix)]
	create /directory $(includedir)]
	create /directory $(exec_prefix)]
	create /directory $(libdir)]
	create /directory $(datadir)]
	create /directory $(datadir).doc]
	create /directory $(sub_docdir)]

uninstall :
	$(RM) $(includedir)]autosprintf.h;
	$(RM) $(libdir)]asprintf.olb;
	$(RM) $(sub_docdir)]autosprintf.html;

check : all
	write sys$output "Nothing else to be done for 'check'."

mostlyclean : clean
	write sys$output "Nothing else to be done for 'mostlyclean'."

clean :
	$(RM) autosprintf.h;*
	$(RM) config.h;*
	$(RM) alloca.h;*
	$(RM) *.obj;*
	$(RM) *.olb;*

distclean : clean
	write sys$output "Nothing else to be done for 'distclean'."

maintainer-clean : distclean
	write sys$output "Nothing else to be done for 'maintainer-clean'."
