## Copyright 1991 1992 OTC LIMITED
## Copyright 1995 DUMPLETON SOFTWARE CONSULTING PTY LIMITED

## Initialisation.

ifeq "$(SRCDIR)" ""
SRCDIR := .
endif

BLDROOT := ../..
SRCROOT := $(SRCDIR)/$(BLDROOT)

MODULES := c install

MAKEIT_OPTIONS := no_objectstore_libraries

override VARIANT := std

include $(SRCROOT)/project/init.mk

## Local definitions.

PROGRAMS := cpp
EXCLUDE := template_sample.c macro_sample.c
BINDIR := $(OSE_HOST_HOME)/lib/$(C++COMPILERTAG)

_makeit_MK_BINARIES := $(MK)/cpp$(BINEXT)

ifeq "$(origin $(C++COMPILER)_STDCPP)" "file"
override STDCPP := $($(C++COMPILER)_STDCPP)
endif
ifneq "$(STDCPP)" "YES"
CPPFLAGS += -DOLD_PREPROCESSOR
endif
ifeq "$(_makeit_cxx_requires_templates)" "YES"
CPPFLAGS += -DCOOL
endif
CPPFLAGS += -DOSE

# INSTALL.BINFLAGS := -s -m 0775

## Makeit modules.

include $(SRCROOT)/project/modules.mk

## Local rules.

# No file called cpp.c, main() routine is actually in cpp1.c which is in the
# library, therefore need to give explicit rule to create cpp from library
# and to set up dependency from all to programs.

all.always :: programs.always

programs.always :: $(PROGRAMS)

cpp : $(MK)/cpp$(BINEXT)

$(MK)/cpp$(BINEXT) : $(MK)/lib.a
	$(LINK.c) $< $(LDLIBS)
	mv a.out $@

ifeq "$(OSE_BUILDALL)" "YES"
install.always :: mostlyclean
endif
