blob: 57f09ff46d9206d138df884a56ac4eaa45fee9e7 (
plain)
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
|
# To avoid a cirular dependency with GPRBuild, this custom BSD Makefile is
# used instead of the provided asis.gpr file.
CP=cp -p
MKDIR=mkdir -p
SRC=gen_src
ADA_FLAGS= -O2 -gnatn -gnatws -gnat05
C_FLAGS= -O2
ADB_SRCS!= cd ${.CURDIR} && ls *.adb | sort -r
GEN_SRCS= sdefault.adb snames.adb xsnamest.adb
ADS_SRCS= rident.ads hostparm.ads err_vars.ads alloc.ads prj-com.ads
LIB_SRCS+= link.c ${GEN_SRCS} ${ADS_SRCS} ${ADB_SRCS:Nlib-*.adb}
LIB_OBJS= ${LIB_SRCS:R:S/$/.o/}
.PHONY: all
.PHONY: generate_sources
.PHONY: libgnat_util.a
.PHONY: install
.PHONY: clean
all: libgnat_util.a
generate_sources:
(cd ${.CURDIR} && ${MKDIR} ${SRC} lib)
${CP} ${.CURDIR}/sdefault_adb.gnat_util ${.CURDIR}/${SRC}/sdefault.adb
(cd ${.CURDIR} && ${CP} \
xsnamest.adb xutil.* snames.adb-tmpl snames.ads-tmpl \
snames.h-tmpl ${SRC})
(cd ${.CURDIR}/${SRC} && \
gnatmake -gnatf -gnatwae -gnatyg -gnatyS xsnamest && \
./xsnamest && mv snames.ns snames.ads && mv snames.nb snames.adb)
${LIB_OBJS}: generate_sources
install:
${MKDIR} ${DESTDIR}${PREFIX}/lib/gnat
${MKDIR} ${DESTDIR}${PREFIX}/lib/gnat_util
${MKDIR} ${DESTDIR}${PREFIX}/include/gnat_util
${BSD_INSTALL_DATA} ../gnat_util.gpr ${DESTDIR}${PREFIX}/lib/gnat
find ../lib -type f -exec $(BSD_INSTALL_DATA) {} \
${DESTDIR}${PREFIX}/lib/gnat_util \;
find ../* -name \*\.ad\[bs\] -exec $(BSD_INSTALL_DATA) {} \
${DESTDIR}${PREFIX}/include/gnat_util \;
clean:
rm -f ${.OBJDIR}/*
rm -f ${.CURDIR}/lib/*
rm -rf ${.CURDIR}/${SRC}
.SUFFIXES: .adb .ads .c .o
.adb.o:
ada ${ADA_FLAGS} -I../ -I../${SRC} -c ../${.TARGET:R}.adb
.c.o:
${CC} ${C_FLAGS} -c ../${.TARGET:R}.c
${ADS_SRCS:R:S/$/.o/}:
ada ${ADA_FLAGS} -I../${SRC} -c ../${.TARGET:R}.ads
${GEN_SRCS:R:S/$/.o/}:
ada ${ADA_FLAGS} -I../ -c ../${SRC}/${.TARGET:R}.adb
libgnat_util.a: ${LIB_OBJS}
ar cq ${.TARGET} `lorder ${LIB_OBJS} | tsort -q`
ranlib ${.TARGET}
mv ${.TARGET} *.ali ../lib
|