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
|
.PHONY: all examples test clean docs install generate_sources do_links static relocatable shared
## Put this first so that it is the default make target
all:
include Makefile.conf
ifeq (${BUILDS_SHARED},yes)
all: relocatable static
else
all: static
endif
include Makefile.gnat
static: build_library_type/static build_tools/static
shared relocatable: build_library_type/relocatable
# Build either type of library. The argument (%) is the type of library to build
build_library_type/%: generate_sources do_links
@echo "====== Building $(@F) libraries ======"
${GPRBUILD} ${GPRBUILD_OPTIONS} -XLIBRARY_TYPE=$(@F) -Pgnatcoll_build -p
@# Need to build libgnatcoll_gtk separately, because its project files
@# requires gtkada.gpr, which might not exist on the machine.
ifeq (${WITH_GTK},yes)
${GPRBUILD} ${GPRBUILD_OPTIONS} -XLIBRARY_TYPE=$(@F) -Psrc/gnatcoll_gtk -p
endif
build_tools/%:
@echo "====== Building tools against $(@F) libraries ======"
@# Build the tools (the list is the project's Main attribute)
@# They are not build as part of the above because only the Main from
@# gnatcoll_build.gpr are build. We could use aggregate projects to speed
@# things up.
${GPRBUILD} -q ${GPRBUILD_OPTIONS} -XLIBRARY_TYPE=$(@F) -Psrc/gnatcoll_tools
# Regenerate part of the sources. Unfortunately, this can be run only after
# we have build GNATCOLL, and then its tools, even though GNATCOLL itself
# relies on those generated sources.
# So this target simply does nothing if gnatcoll_db2ada is not found, in which
# case we use the checked in sources (which means that changing the dbschema
# requires to have already build GNATCOLL once before)
generate_sources:
-if [ -f src/obj/gnatcoll_db2ada${EXE} ]; then \
echo "Regenerating files in src/generated/."; \
for f in src/generated/*.ad?; do \
mv $$f $$f.old; \
done; \
src/obj/gnatcoll_db2ada${EXE} -dbtype=sqlite -dbname=:memory: \
-output src/generated \
-dbmodel=src/dbschema.txt \
-createdb \
-adacreate \
-api GNATCOLL.Xref.Database \
-load=src/initialdata.txt \
-enum "f2f_kind,id,name,F2F_,Integer" \
-enum "e2e_kind,id,name,E2E_,Integer"; \
for f in src/generated/*.ad?; do \
tr -d '\r' < $$f > $$f.tmp && mv $$f.tmp $$f; \
if diff -q $$f.old $$f ; then \
mv $$f.old $$f; \
else \
rm $$f.old; \
fi; \
done; \
fi
examples:
${MAKE} -C examples all
SQLITE_DIR=src/sqlite/amalgamation
sqlite3_shell: $(SQLITE_DIR)/sqlite3_for_gps
$(SQLITE_DIR)/sqlite3_for_gps: $(SQLITE_DIR)/shell.c $(SQLITE_DIR)/sqlite3.c
ifeq ($(OS),Windows_NT)
-cd $(SQLITE_DIR); gcc -O2 -DSQLITE_OMIT_LOAD_EXTENSION -D__EXTENSIONS__ -o sqlite3_for_gps shell.c sqlite3.c
else
# If we fail to compile, never mind. Some tests will simply be disabled
-cd $(SQLITE_DIR); gcc -O2 -DSQLITE_OMIT_LOAD_EXTENSION -D__EXTENSIONS__ -o sqlite3_for_gps shell.c sqlite3.c -lpthread -ldl
endif
## Create links for the gnat sources
do_links:
ifeq ($(GNAT_SOURCES),copy)
ifeq ($(OS),Windows_NT)
-$(foreach f,$(GNAT_SOURCES_FOR_GNATCOLL), \
$(CP) -f gnat_src/$(f) gnat >/dev/null 2>&1 ;)
else
-$(foreach f,$(GNAT_SOURCES_FOR_GNATCOLL), \
$(LN_S) -f ../gnat_src/$(f) gnat >/dev/null 2>&1 ;)
endif
(cd gnat && gnatmake -q xsnamest && ./xsnamest && mv snames.ns snames.ads && mv snames.nb snames.adb)
endif
## Only works after installation, so we should install to a local directory
## first, so as not to break the users's environment, but still test the
## actual installation process.
## However, we do not force a recompilation here for now, so that we can still
## run the tests on the current binaries, even if we are doing some modifs
## that are not yet compilable
test_names=
local_install: force
${MAKE} prefix=${shell pwd}/local_install install >/dev/null
test: sqlite3_shell local_install
${MAKE} test_names="${test_names}" -C testsuite
test_verbose: local_install
${MAKE} test_names="${test_names}" -C testsuite verbose
# Installs both static and shared libraries (if they were build)
# GNU standards say we must not recompile, for this target
install:
${MKDIR} ${bindir}
${MKDIR} ${DESTDIR}${prefix}/lib/gnat/${TARNAME}
${MKDIR} ${datadir}/${TARNAME}
${MKDIR} ${includedir}/${TARNAME}
${CP} src/dborm.py ${datadir}/${TARNAME}/
${CP} distrib/*.gpr ${DESTDIR}${prefix}/lib/gnat
${MKDIR} ${datadir}/examples/${TARNAME}
@# Do not want to copy .svn directories
${CP} -rf examples/* ${datadir}/examples/${TARNAME}
${MKDIR} ${datadir}/gps/support/core/gnatcoll
${CP} distrib/gnatcoll/*py ${datadir}/gps/support/core/gnatcoll/
${MKDIR} ${datadir}/doc/${TARNAME}/html
-${CP} -r docs/_build/html/* ${datadir}/doc/${TARNAME}/html 2>/dev/null
-${CP} docs/_build/latex/GNATColl.pdf ${datadir}/doc/${TARNAME}/gnatcoll.pdf 2>/dev/null
${MKDIR} ${libdir}/${TARNAME}/static
ifeq (${BUILDS_SHARED},yes)
${MKDIR} ${libdir}/${TARNAME}/relocatable
endif
${MAKE} -C src -f Makefile.gnatcoll libinstall
${MAKE} -C src -f Makefile.python libinstall
ifeq (${WITH_GTK},yes)
${MAKE} -C src -f Makefile.gtk libinstall
endif
${MAKE} -C src -f Makefile.iconv libinstall
${MAKE} -C src -f Makefile.postgres libinstall
${MAKE} -C src -f Makefile.sqlite libinstall
${MAKE} -C src -f Makefile.readline libinstall
${MAKE} -C src -f Makefile.tools installbin
ifeq (${WITH_GMP},yes)
${MAKE} -C src -f Makefile.gmp libinstall
endif
## Clean either type of library, based on the value of (%)
clean_library/%:
-${GPRCLEAN} ${GPRCLEAN_OPTIONS} -r -Pgnatcoll_build -XLIBRARY_TYPE=$(@F)
@# Separate pass to also remove the Main
-${GPRCLEAN} ${GPRCLEAN_OPTIONS} -r -Psrc/gnatcoll_tools -XLIBRARY_TYPE=$(@F)
ifeq (${WITH_GTK},yes)
-${GPRCLEAN} ${GPRCLEAN_OPTIONS} -r -Psrc/gnatcoll_gtk -XLIBRARY_TYPE=$(@F)
endif
clean: clean_library/static clean_library/relocatable
-${MAKE} -C testsuite $@
-${MAKE} -C docs $@
-${MAKE} -C examples $@
distclean: clean
${RM} \
Makefile.conf \
check.ali \
check.o \
config.log \
config.status \
distrib/gnatcoll.gpr \
distrib/gnatcoll.gpr__copy \
distrib/gnatcoll.gpr__gnat_util \
distrib/gnatcoll_gmp.gpr \
distrib/gnatcoll_python.gpr \
examples/obj/auto.cgpr \
gnat/sdefault/sdefault.adb \
gnatcoll_shared.gpr \
src/gnatcoll-atomic.adb \
src/gnatcoll-refcount-sync_counters.adb \
src/gnatcoll.gpr \
src/gnatcoll_gmp.gpr \
src/gnatcoll_python.gpr \
src/gnatcoll_readline.gpr \
src/lib/gmp/relocatable/libgnatcoll* \
src/lib/*/relocatable/libgnatcoll* \
src/obj/auto.cgpr \
src/obj/b__gnatinspect.adb \
src/obj/b__gnatinspect.ads \
src/obj/b__gnatinspect.ali \
src/obj/b__gnatinspect.o \
src/obj/gtk/relocatable/auto.cgpr
docs:
${MAKE} -C docs html latexpdf
force:
|