-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (30 loc) · 870 Bytes
/
Copy pathMakefile
File metadata and controls
39 lines (30 loc) · 870 Bytes
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
CC = gcc
CFLAGS = -fPIC -O3
LFLAGS =
SRCDIR = src
OBJDIR = build
SOURCES := $(wildcard $(SRCDIR)/*.c)
INCLUDES := $(wildcard $(SRCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
rm = rm -Rf
all: build_buildDir $(OBJECTS)
$(CC) -shared -Wl,-soname,librhd.so -o $(OBJDIR)/librhd.so $(OBJECTS) $(LFLAGS)
ar rcs $(OBJDIR)/librhd.a $(OBJECTS) $(LFLAGS)
install:
cp $(OBJDIR)/librhd.so /usr/local/lib/.
cp $(OBJDIR)/librhd.a /usr/local/lib/.
cp src/rhd.h /usr/local/include/.
uninstall:
rm -f /usr/lib/librhd.so
rm -f /usr/lib/librhd.a
rm -f /usr/include/rhd.h
test:
cmake -Stests/ -Btests/build
cmake --build tests/build && ctest --test-dir tests/build --output-on-failure
build_buildDir:
@mkdir -p $(OBJDIR)
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
$(rm) $(OBJDIR)