Files
florist/Makefile.in
Frederic Konrad ebb4c80d34 Makefile.in: make the generated files explicitely required by floristlib
With the last patch, the generated files became "intermediate files" as
documented in the manual.  In such situation, 'make' just remove them when
not needed anymore.  Add them as a prerequisite of floristlib as before to
avoid this situation.

TN: V111-031
Change-Id: Ic15c3267c7319077470f66579e648b3cda38541c
2022-01-11 15:01:49 +01:00

198 lines
5.6 KiB
Makefile

# This builds the "Florist" implementation of POSIX.5b
#
# If you need to modify the "configure" file, you will need
# autoconf version 2.12, or maybe a later version will also work.
#
.POSIX:
VERSION=7.3.0w
FLORIST_VERSION=$(VERSION)
GNATPREPFLAGS = -c -r
GCCFLAGS = -O2
TARGET=@host_alias@
ifneq ($(TARGET),)
TARGET_OPTION=--target=$(TARGET)
TARGET_PREFIX=$(TARGET)-
endif
ifeq ($(TARGET),powerpc-elinos-linux)
TARGET_RUNNER=run-cross --target=ppc-elinos,5.1,qemu
endif
# How to invoke ranlib.
RANLIB = ranlib
# configure substitutions
CC = @CC@
LIBS = @LIBS@
DEPS = @DEPS@
SIGNALS_GENERATED = @SIGNALS_GENERATED@
PREFIX = @prefix@
ENABLE_SHARED = @ENABLE_SHARED@
PROJECT_FLAGS = @BUILD_TYPE_OPTION@ @THREADS_OPTION@ @RTS_OPTION@ \
$(TARGET_OPTION)
# Scenario variables and RTS selection must be passed consistently to
# project-aware tools gprbuild, gprinstall, and gprclean.
GNATPREP = $(TARGET_PREFIX)gnatprep
GPRBUILD = gprbuild
GPRBUILD_FLAGS = $(GCCFLAGS) $(PROJECT_FLAGS)
GENDIR = gensrc
GENDIR_ON_TARGET=$(GENDIR)
# files generated by "configure" script
CONFIG_GENERATED = \
confsrc/config.h\
confsrc/pconfig.h\
gnatprep.config\
pconfig.h.in
CONFIG_HISTORY = \
config.cache\
config.log\
c-posix.log\
configure.log\
config.status\
stamp-h
# files generated by "c-posix" program
C-POSIX_GENERATED = \
$(GENDIR)/posix.ads\
$(GENDIR)/posix-limits.ads\
$(GENDIR)/posix-options.ads\
$(GENDIR)/posix-c.ads
# files generated by "c-posix-signals" program (if present)
ifneq "$(strip $(SIGNALS_GENERATED))" ""
C-POSIX-SIGNALS_GENERATED = $(GENDIR)/$(SIGNALS_GENERATED)
else
C-POSIX-SIGNALS_GENERATED =
endif
GNATPREP_SOURCES = $(GENDIR)/posix-implementation.adb $(GENDIR)/threads/posix-timers-extensions.adb
GENERATED = $(C-POSIX_GENERATED) $(C-POSIX-SIGNALS_GENERATED) $(GNATPREP_SOURCES)
# all the executable programs
EXECUTABLES = c-posix c-posix-signals
# default target, get the gnat version and the system type and then
# set up files and call make again (in uname)
all: floristlib
#
# ------------------------------------
# configure-script
# ------------------------------------
#
# This first step should not need to be done during
# normal installation
#
configure: configure.in aclocal.m4
autoconf
#
# ------------------------------------
# generation of OS dependent sources
# ------------------------------------
#
# Program c-posix generates some Ada package specs.
# It is supposed to be a "portable" POSIX C program.
# If it does not compile or does not link,
# it might be fixable by hand-editing config.h or pconfig.h.
# If you are unlucky, it will require fixes to c-posix.c.
#
c-posix: c-posix.c confsrc/config.h confsrc/pconfig.h
$(CC) $(GCCFLAGS) -DVERSION="\"$(VERSION)\"" -DLIBS="\"$(LIBS)\"" -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix c-posix.c $(LIBS)
#
# Program c-posix-signals generates another Ada package spec.
#
c-posix-signals: c-posix-signals.c
$(CC) $(GCCFLAGS) -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix-signals c-posix-signals.c $(LIBS)
#
# generate Ada source files using "c-posix" program
#
$(C-POSIX_GENERATED): c-posix
mkdir -p $(GENDIR) && cd $(GENDIR) && rm -f posix.ads posix-limits.ads posix-options.ads posix-c.ads
# See file "c-posix.log" for results of this step.
$(TARGET_RUNNER) ./c-posix > c-posix.log 2>&1
#
# generate Ada source files using "c-posix-signals" program
#
$(C-POSIX-SIGNALS_GENERATED): c-posix-signals
mkdir -p $(GENDIR) && cd $(GENDIR) && rm -f posix-implementations-ok_signals.ads
# See file "c-posix-signals.log" for results of this step.
$(TARGET_RUNNER) ./c-posix-signals -nodefaults > c-posix-signals.log 2>&1
#
# Some other Ada source files are tailored to the
# particular OS using the "gnatprep" program.
# The sources for these end in ".gpb" and ".gps".
#
.SUFFIXES: .gps .gpb .ads .adb .o .c
$(GENDIR)/%.ads: libsrc/%.gps gnatprep.config
mkdir -p `dirname $@` && $(GNATPREP) $< $@ gnatprep.config $(GNATPREPFLAGS)
$(GENDIR)/%.adb: libsrc/%.gpb gnatprep.config
mkdir -p `dirname $@` && $(GNATPREP) $< $@ gnatprep.config $(GNATPREPFLAGS)
.c.o:
$(CC) -c $(GCCFLAGS) $<
#
# ------------------------------------
# compilation of Florist packages
# ------------------------------------
#
force:
# build both static and shared library when shared is enabled
ifeq ($(ENABLE_SHARED), yes)
floristlib: $(GENERATED) floristlib-static floristlib-relocatable
install: install-static install-relocatable
# ensure that the relocatable version is build first so the static library
# will use the objects that are already built.
floristlib-static: floristlib-relocatable
# ensure that we don't have two instances of gprinstall trying to install at
# the same time.
install-relocatable: install-static
else
floristlib: $(GENERATED) floristlib-static
install: install-static
endif
floristlib-%: force
$(GPRBUILD) -p $(GPRBUILD_FLAGS) -XLIBRARY_TYPE=$* -Pflorist
# -----------------------------------
# Maintenance targets
# -----------------------------------
#
# remove all c-posix and gnatprep generated files
regen:
rm -f $(GENERATED)
# remove editor and compiler generated files
clean: regen
gprclean -Pflorist $(PROJECT_FLAGS)
rm -rf obj lib
rm -f *# *~ $(EXECUTABLES) b__* b~*
# remove all generated files, including configuration history
distclean: clean
rm -f $(CONFIG_HISTORY) $(CONF_GENERATED)
# install floristlib
# make all files read-only to prevent recompilation
install-%:
gprinstall -Pflorist $(PROJECT_FLAGS) -XLIBRARY_TYPE=$* -a -p -f \
--prefix=$(PREFIX) --sources-subdir=floristlib \
--lib-subdir=floristlib --link-lib-subdir=floristlib \
--build-name=$*
chmod a-w $(PREFIX)/floristlib/*
.PHONY: all install clean distclean regen floristlib force