File: use-gprbuild-for-projects.diff

package info (click to toggle)
libtexttools 2.1.0-26
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 964 kB
  • sloc: ada: 11,394; ansic: 529; makefile: 104; sed: 75; sh: 12
file content (73 lines) | stat: -rw-r--r-- 2,566 bytes parent folder | download
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
Description: Use gprbuild for projects, as gnatmake will soon drop
 support for them.
Author: Nicolas Boulenguez

--- a/Makefile
+++ b/Makefile
@@ -74,7 +74,7 @@
 build: build-dynamic build-static
 
 build-dynamic build-static: build-%: $(LIB_NAME).gpr
-	gnatmake -P$< $(GNATMAKE_OPTIONS) -XKIND=$*
+	gprbuild $< $(GNATMAKE_OPTIONS) -XKIND=$*
 clean::
 	rm -f $(foreach dir,obj lib,$(foreach kind,dynamic static,build-$(dir)-$(kind)/*))
 
@@ -82,16 +82,23 @@
 	find -name "*~" -delete
 
 test: examples/examples.gpr build-static
-	gnatmake -P$< $(GNATMAKE_OPTIONS) -XKIND=static
+	gprbuild $< $(GNATMAKE_OPTIONS) -XKIND=static
 # Texttools.gpr is found in the current directory when executing this
 # recipe, and will be found in the default system location after
 # installation.
 
 clean:: examples/examples.gpr texttools.gpr
-	gnatclean -P$< -XKIND=static
+	gprclean $< -XKIND=static
 	rm -f $^
 # We need to create them for gnatclean, then suppress it as the last action.
 
+gnat_version != gnatmake --version | sed 's/.* \([0-9]\+\).*/\1/;q'
+build-dynamic build-static test: default.cgpr
+default.cgpr:
+	gprconfig --batch --config=Ada --config=C,,,,gcc-$(gnat_version)
+clean::
+	rm -f default.cgpr
+
 install: build
 	install --directory $(DESTDIR)/$(SRC_DIR)/$(LIB_NAME)
 	install --mode=644 src/*.ad[sb] src/*.[ch] $(DESTDIR)/$(SRC_DIR)/$(LIB_NAME)
@@ -116,31 +123,6 @@
 	rm -f $(DESTDIR)/$(LIB_DIR)/lib$(LIB_NAME).so.$(SOVERSION)
 	rm -f $(DESTDIR)/$(LIB_DIR)/lib$(LIB_NAME).so
 
-############################################################
-#  All that C stuff will be unnecessary with gprbuild’s mixed C/Ada
-#  project files.  For the moment, gnatmake will embed all .o files,
-#  we only have to compile them and store them in the object dir.
-
-C_SRC := $(wildcard src/*.c)
-
-C_OBJ_DYNAMIC := $(patsubst src/%.c,build-obj-dynamic/%.o,$(C_SRC))
-build-dynamic: $(C_OBJ_DYNAMIC)
-$(C_OBJ_DYNAMIC): build-obj-dynamic/%.o: src/%.c
-	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ -fPIC
-
-C_OBJ_STATIC  := $(patsubst src/%.c,build-obj-static/%.o, $(C_SRC))
-build-static: $(C_OBJ_STATIC)
-$(C_OBJ_STATIC): build-obj-static/%.o: src/%.c
-	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
-
-C_OBJ_TEST    := $(patsubst src/%.c,examples/%.o,  $(C_SRC))
-test: $(C_OBJ_TEST)
-$(C_OBJ_TEST): CFLAGS += -g -Wall -Wextra
-$(C_OBJ_TEST): examples/%.o: src/%.c
-	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
-clean::
-	rm -f $(C_OBJ_TEST)
-
 # gnatmake 4.4 does not handle External_As_List, so we emulate it with
 # a template instead of passing the options with -X.
 comma := ,