1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
# file: Makefile [$Revision: 1.39 $]
#
# This builds the "Florist" implementation of POSIX.5b,
# and some test programs for it.
#
# 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=Florist-2006 (20060522)
FLORIST_VERSION=$(VERSION)
GNATMAKEFLAGS1B = -O2 -gnatpg
GNATPREPFLAGS = -c -r
GCCFLAGS = -O2
# How to invoke ranlib.
RANLIB = ranlib
# The following will be set based on
# what the configure script discovers about the local system.
CC = @CC@
LIBS = @LIBS@
DEPS = @DEPS@
ADDRINFO_OBJECTS = @ADDRINFO_OBJECTS@
SIGNALS_GENERATED = @SIGNALS_GENERATED@
PREFIX = @prefix@
# files generated by "configure" script
CONFIG_GENERATED = \
config.h\
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 = \
posix.ads\
posix-limits.ads\
posix-options.ads\
posix-c.ads
# files generated by "c-posix-signals" program
C-POSIX-SIGNALS_GENERATED = $(SIGNALS_GENERATED)
GNATPREP_SOURCES = posix-implementation.adb posix-timers-extensions.adb \
posix-process_identification.adb posix-unsafe_process_primitives.adb \
posix-process_primitives.adb
GENERATED = $(CONFIG_GENERATED) $(C-POSIX_GENERATED) $(GNATPREP_SOURCES) \
$(C-POSIX-SIGNALS_GENERATED)
# all the executable programs
EXECUTABLES = c-posix c-posix-signals
MACRO_OBJECTS = posix-macros.o posix-macros-sockets.o
# 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 config.h pconfig.h
$(CC) $(GCCFLAGS) -DVERSION="\"$(VERSION)\"" -DLIBS="\"$(LIBS)\"" -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) -o c-posix-signals \
c-posix-signals.c $(LIBS)
#
# generate Ada source files using "c-posix" program
#
$(C-POSIX_GENERATED): c-posix
rm -f posix.ads posix-limits.ads posix-options.ads posix-c.ads\
tmpposix.ads
# See file "c-posix.log" for results of this step.
./c-posix > c-posix.log 2>&1
rm -f tmpposix.ads
#
# generate Ada source files using "c-posix-signals" program
#
posix-implementation-ok_signals.ads: c-posix-signals
rm -f posix-implementations-ok_signals.ads
# See file "c-posix-signals.log" for results of this step.
./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".
#
$(GNATPREP_SOURCES): gnatprep.config
.SUFFIXES: .gps .gpb .ads .adb .o .c
.gps.ads:
gnatprep $< $@ gnatprep.config $(GNATPREPFLAGS)
.gpb.adb:
gnatprep $< $@ gnatprep.config $(GNATPREPFLAGS)
.c.o:
$(CC) -c $(GCCFLAGS) $<
.PHONY: deps deps_no_thread
#
#
# Some POSIX interfaces use macros.
# To make these usable from Ada, we have C subprograms.
#
$(MACRO_OBJECTS): pconfig.h
#
# Some POSIX interfaces use macros.
# To make these usable from Ada, we have C subprograms.
#
$(ADDRINFO_OBJECTS): pconfig.h
#
# ------------------------------------
# compilation of Florist packages
# ------------------------------------
#
# "deps.adb" is dummy main program, with dependences
# that should force compilation of all Florist packages;
# "deps5c.adb" is the same, but with POSIX.5c packages added.
#
deps deps_no_thread: $(GENERATED)
gnatmake -c $(GNATMAKEFLAGS1B) $@
#
# -----------------------------------
# Create a florist library for objects
# -----------------------------------
#
floristlib: $(MACRO_OBJECTS) $(DEPS) $(ADDRINFO_OBJECTS)
@echo "Creating libflorist.a in directory floristlib"
@if [ -d floristlib ]; then rm -rf floristlib; fi
mkdir floristlib
cp -p *.ads floristlib
cp -p *.adb floristlib
(tar cpf - *.o *.ali) | (cd floristlib; tar xpf -)
rm -f floristlib/$(DEPS).o floristlib/$(DEPS).ali
ar -r floristlib/libflorist.a floristlib/*.o
-$(RANLIB) floristlib/libflorist.a
chmod 444 floristlib/*.ali
rm -f floristlib/*.o
#
# ---------
# Testing
# ---------
#
compile_tests:
cd tests; make tests
run_tests:
cd tests; make run_tests
#
# -----------------------------------
# Maintenance targets
# -----------------------------------
#
# remove all c-posix and gnatprep generated files
regen:
rm -f $(C-POSIX_GENERATED)
# remove editor and compiler generated files
clean:
rm -rf floristlib
rm -f *.o *.ali a.out *# *~ $(EXECUTABLES) b_*.c b~*
rm -f $(C-POSIX_GENERATED) $(GNATPREP_SOURCES)
-make -C tests clean
# remove all generated files, including configuration history
distclean:
rm -f $(CONFIG_HISTORY)
rm -rf floristlib
rm -f *.o *.ali a.out *# *~ $(EXECUTABLES) b_*.c b~*
rm -f $(GENERATED) $(GNATPREP_SOURCES)
-make -C tests clean
# install floristlib
install: floristlib
mkdir -p $(PREFIX)/lib/gnat
cp -pr floristlib $(PREFIX)/floristlib
cp -p florist.gpr $(PREFIX)/lib/gnat
|