File: Makefile

package info (click to toggle)
cohomcalg 0.32+ds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,932 kB
  • sloc: cpp: 3,291; makefile: 41; ansic: 17
file content (65 lines) | stat: -rw-r--r-- 1,962 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
#########################################################################
#                                                                       #
#  Makefile for the cohomCalg application (including modified PolyLib)  #
#                                                                       #
#########################################################################

# compilers & flags
CC        := g++
CFLAGS    := -O3
LD        := g++
# Note: (1) If you want to enforce 32-bit or 64-bit compilation, 
#           add "-m32" or "-m64" to both CFLAGS and LDFLAGS.
#       (2) If you want to enforce a static linking of all libraries 
#           (i.e. include everything into one binary), add "-static" to LDFLAGS


# global defs
DEFS      := -DPOLYLIB_BITS=64

# directories
COHOMCALG_SRC_DIR := source
POLYLIB_SRC_DIR   := source/polylib_mod
BUILD_DIR         := build/polylib_mod build

# source and object files
COHOMCALG_SRC := $(foreach sdir,$(COHOMCALG_SRC_DIR),$(wildcard $(sdir)/*.cpp))
COHOMCALG_OBJ := $(patsubst source/%.cpp,build/%.o,$(COHOMCALG_SRC))
POLYLIB_SRC   := $(foreach sdir,$(POLYLIB_SRC_DIR),$(wildcard $(sdir)/*.c))
POLYLIB_OBJ   := $(patsubst source/%.c,build/%.o,$(POLYLIB_SRC))
INCLUDES      := $(addprefix -I,$(COHOMCALG_SRC_DIR) $(POLYLIB_SRC_DIR))

vpath %.c $(POLYLIB_SRC_DIR)
vpath %.cpp $(COHOMCALG_SRC_DIR)

# macros for .c/.cpp dirs
define make-goal-cpp
$1/%.o: %.cpp
	$(CC) $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CXXFLAGS) -c $$< -o $$@
endef

define make-goal-c
$1/%.o: %.c
	$(CC) $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $$< -o $$@
endef


.PHONY: all checkdirs clean

all: checkdirs bin/cohomcalg

bin/cohomcalg: $(COHOMCALG_OBJ) $(POLYLIB_OBJ)
	$(LD) $^ $(LDFLAGS) -lpthread -lpolylib64 -o $@
#-static -lsource/polylib-5.22.5/.libs/libpolylib64.a

checkdirs: $(BUILD_DIR)

$(BUILD_DIR):
	@mkdir -p $@

clean:
	@rm -rf $(BUILD_DIR)


$(eval $(call make-goal-c, build/polylib_mod))
$(eval $(call make-goal-cpp, build))