-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile_6_project
78 lines (71 loc) · 1.44 KB
/
Makefile_6_project
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
$ cat src/main/Makefile
# build shared library with -fPIC, -shared
CFLAGS = -g # -O3 -fPIC # CXXFLAGS for .cpp
CPPFLAGS = -MMD -MP # -I../foo
LDFLAGS = # -L../foo -Wl,-rpath,'$$ORIGIN/../foo' # -shared
LDLIBS = # -lfoo
#CC = $(CXX) # link with CXX for .cpp
# target name is basename of one of the source files
main : $(patsubst %.c,%.o,$(wildcard *.c)) # .cpp
-include *.d
clean : ; -rm -fr *.o *.d
.PHONY : clean
$
$ cat src/Makefile
LIBDIRS = bar foo
MAINDIRS = main1 main2
all : $(LIBDIRS) $(MAINDIRS)
foo : bar
main1 : foo
main2 : foo
$(MAINDIRS) : $(LIBDIRS)
$(LIBDIRS) :
$(MAKE) -C $@
cp $@/$@ $@/lib$@.so
$(MAINDIRS) :
$(MAKE) -C $@
clean :
for dir in $(LIBDIRS) $(MAINDIRS); do \
$(MAKE) -C $$dir $@; \
done
.PHONY : $(LIBDIRS) $(MAINDIRS) all clean
$
$ cat .vscode/launch.json
{
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"cwd": "${fileDirname}",
"preLaunchTask": "make",
}
]
}
$
$ cat .vscode/tasks.json
{
"tasks": [
{
"label": "make",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/src",
},
"command": "/usr/bin/make",
}
]
}
$
$ cat .vscode/settings.json
{
"clangd.fallbackFlags": [
// "-std=c++2a",
// "-I${workspaceFolder}/boost",
"-I${workspaceFolder}/src/foo",
"-I${workspaceFolder}/src/bar",
],
}
$