-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.in
124 lines (98 loc) · 3.67 KB
/
Makefile.in
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
#
# Makefile rules for the GaloisGroups package
#
# This requires GNU make (just as the main GAP does).
#
# For simple packages one should only need to modify the MODULE_NAME
# and the SOURCES variable.
#
MODULE_NAME = GaloisGroups
SOURCES = src/GaloisGroups.c
TOP = $(shell pwd)
EXTRA_CPPFLAGS = @EXTRA_CPPFLAGS@
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@ -lpari
EXTERN_FILES =
########################################################################
# Do not edit below unless you know what you're doing
########################################################################
########################################################################
# Some variables that come from GAP via our configure script
########################################################################
GAPPATH = @GAPPATH@
GAPARCH = @GAPARCH@
BINARCHDIR = bin/@GAPARCH@
GAPINSTALLIB = $(BINARCHDIR)/$(MODULE_NAME).so
MKDIR_P = /bin/mkdir -p
GAP = @GAPPATH@/gap
GAC = @GAPPATH@/gac
all: $(GAPINSTALLIB)
.PHONY: all
########################################################################
# Object files
# For each file FOO.c in SOURCES, add gen/FOO.lo to OBJS; similar
# for .cc files
########################################################################
OBJS = $(patsubst %.cc,gen/%.lo,$(patsubst %.c,gen/%.lo,$(SOURCES)))
########################################################################
# Quiet rules.
#
# Replace regular output with quiet messages, unless V is set,
# e.g. "make V=1"
########################################################################
ifneq ($(findstring $(MAKEFLAGS),s),s)
ifndef V
QUIET_GAC = @echo " GAC $< => $@";
LIBTOOL += --silent
endif
endif
########################################################################
# Rules for automatic header dependency tracking.
# This is based on the GAP build system.
########################################################################
# List of all (potential) dependency directories, derived from OBJS
# and SOURCES (the latter for generated sources, which may also involve
# dependency tracking)
DEPDIRS = $(sort $(dir $(SOURCES) $(OBJS)))
ALL_DEP_FILES = $(wildcard $(addsuffix /*.d,$(DEPDIRS)))
# Include the dependency tracking files.
-include $(ALL_DEP_FILES)
# Mark *.d files as PHONY. This stops make from trying to
# recreate them (which it can't), and in particular from looking for potential
# source files. This can save quite a bit of disk access time.
.PHONY: $(ALL_DEP_FILES)
# The following flags instruct the compiler to enable advanced
# dependency tracking. Supported by GCC 3 and newer; clang; Intel C
# compiler; and more.
DEPFLAGS = -MQ "$@" -MMD -MP -MF $(@D)/$(*F).d
# build rule for C code
gen/%.lo: %.c
@$(QUIET_GAC)$(GAC) -d -p "$(DEPFLAGS)" -p "$(EXTRA_CPPFLAGS)" -c $< -o $@
# build rule for C++ code
gen/%.lo: %.cc
@$(QUIET_GAC)$(GAC) -d -p "$(DEPFLAGS)" -p "$(EXTRA_CPPFLAGS)" -c $< -o $@
# build rule for linking all object files together into a kernel extension
# TODO: detect pari lib and header files
$(GAPINSTALLIB): $(OBJS)
@$(MKDIR_P) $(BINARCHDIR)
@$(QUIET_GAC)$(GAC) -d -p "$(DEPFLAGS)" $(OBJS) -L "$(EXTRA_LDFLAGS)" -o $@
clean:
rm -rf $(BINARCHDIR)
rm -rf gen
distclean:
rm -rf bin gen Makefile
(cd doc && ./clean)
doc: default
$(GAP) makedoc.g
check: default
$(GAP) tst/testall.g
Makefile: configure Makefile.in
./configure "@GAPPATH@"
.PHONY: default clean distclean doc check
$(OBJS): $(EXTERN_FILES)
$(GAPINSTALLIB): $(EXTERN_FILES)
########################################################################
# Makefile debugging trick:
# call print-VARIABLE to see the runtime value of any variable
########################################################################
print-%:
@echo '$*=$($*)'