-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (28 loc) · 761 Bytes
/
Makefile
File metadata and controls
35 lines (28 loc) · 761 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
CC=g++
CFLAGS=-c -Wall -std=c++11
LDFLAGS=-lbunit
SOURCES=BUnit.cpp
TEST=test.cpp
OBJECTS=$(TEST:.cpp=.o)
EXECUTABLE=BUnit
LIBRARY=libbunit.so
STATIC_LIBRARY=libbunit.a
all: $(LIBRARY) $(STATIC_LIBRARY)
BUnit.o: BUnit.cpp BUnit.h
$(CC) $(CFLAGS) -fpic $(SOURCES)
$(LIBRARY): BUnit.o
$(CC) -shared -o $(LIBRARY) $(SOURCES:.cpp=.o)
$(STATIC_LIBRARY): BUnit.o
$(AR) r $(STATIC_LIBRARY) $(SOURCES:.cpp=.o)
install: all
mkdir -p /usr/include/bunit
install BUnit.h /usr/include/bunit/
install libbunit.so /usr/lib/
test: $(TEST) $(EXECUTABLE)
./$(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) $(STATIC_LIBRARY)
$(CC) $(OBJECTS) $(STATIC_LIBRARY) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
clean:
rm -rf *.o $(LIBRARY) $(STATIC_LIBRARY) $(EXECUTABLE)