Repository navigation
Expand file tree
/
Copy pathmakefile-Module
More file actions
107 lines (76 loc) · 3.42 KB
/
Copy pathmakefile-Module
File metadata and controls
107 lines (76 loc) · 3.42 KB
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
##############################################################################
############################# makefile-Module ################################
##############################################################################
# #
# makefile of Module_test (for core SMS++) #
# #
# The test imports the C++20 module smspp in place of the headers, hence #
# it is built with the module, i.e., with SMSppMOD not empty and clang++ #
# 16 or later [see lib/makefile-mod]: #
# #
# make -f makefile-Module #
# #
# Antonio Frangioni #
# Dipartimento di Informatica #
# Universita' di Pisa #
# #
##############################################################################
# module name
NAME = Module_test
# basic directory
DIR = .
# compiler
CC = clang++
# the C++20 modules are built
SMSppMOD = 1
# common flags
COMMON_SW = -std=c++20
# debug switches
SW_DEBUG = -g $(COMMON_SW)
# production switches
SW_RELEASE = -O3 -DNDEBUG $(COMMON_SW)
# default target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
default: release
# debug target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
debug: SW = $(SW_DEBUG)
debug: $(NAME)
# release target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
release: SW = $(SW_RELEASE)
release: $(NAME)
# clean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clean::
rm -f $(DIR)/tests_Module.o $(DIR)/*~ $(NAME)
# define & include the necessary modules- - - - - - - - - - - - - - - - - - -
# if a module is not used in the current configuration, just comment out the
# corresponding include line
# each module outputs some macros to be used here:
# *OBJ is the final object(s) / library
# *LIB is the external libraries + -L< libdirs >
# *H is the list of all include files, and the module file
# *INC is the -I< include directories >
# core SMS++
SMS++SDR = ..
include $(SMS++SDR)/lib/makefile-inc
ifeq ($(SMSppMOD),)
$(error $(NAME) needs the C++20 module smspp)
endif
# main module (linking phase) - - - - - - - - - - - - - - - - - - - - - - - -
# object files
MOBJ = $(SMS++OBJ)
# libraries
MLIB = $(SMS++LIB)
$(NAME): $(MOBJ) $(DIR)/tests_Module.o
$(CC) -o $(NAME) $(DIR)/tests_Module.o $(MOBJ) $(MLIB) $(SW)
# dependencies: every .o from its .cpp + every recursively included .h- - - -
# include directives
MINC = $(SMS++INC)
# includes, and the module file
MH = $(SMS++H)
# compile command
$(DIR)/tests_Module.o: $(DIR)/tests_Module.cpp $(MH)
$(CC) -c $(DIR)/tests_Module.cpp -o $@ $(MINC) $(SW)
# distclean target- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
distclean: clean
# phony targets - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.PHONY: debug release clean distclean
######################### End of makefile-Module #############################