Makefile 1.12 KB
Newer Older
Achim Morschhauser's avatar
Achim Morschhauser committed
1
2
3
SRC_DIR=src/
OBJ_DIR=lib/
HDR_DIR=include/
Achim Morschhauser's avatar
Achim Morschhauser committed
4
LIB_DIR=./lib/
5

Achim Morschhauser's avatar
Achim Morschhauser committed
6
7
USR_DIR=usr/
BIN_DIR=bin/
Achim Morschhauser's avatar
Achim Morschhauser committed
8
9
10

#--------------------------------------
#--------------------------------------
11
12
13
14
SRC_FILES  = $(wildcard $(SRC_DIR)*.cpp)
OBJ_FILES  = $(patsubst $(SRC_DIR)%.cpp,$(OBJ_DIR)%.o,$(SRC_FILES))
USR_FILES  = $(wildcard $(USR_DIR)*.cpp)
USR_TARGET = $(patsubst $(USR_DIR)%.cpp,%,$(USR_FILES))
Achim Morschhauser's avatar
Achim Morschhauser committed
15
16
17
18
19
#--------------------------------------
CC=g++

CCFLAGS=-g  -lrt -std=c++11 -pthread

20
EXCL=driver_serial_emulate.o
Achim Morschhauser's avatar
Achim Morschhauser committed
21
# Uncomment to use virtual serial port. Run 'make clean all' afterwards
Achim Morschhauser's avatar
Achim Morschhauser committed
22
EXCL=driver_serial.o
Achim Morschhauser's avatar
Achim Morschhauser committed
23

24
.SECONDARY:
Achim Morschhauser's avatar
Achim Morschhauser committed
25

26
27
28
29
30
31
all: $(USR_TARGET:%=$(BIN_DIR)%)

%: $(BIN_DIR)%
	@echo ---- DONE ----


Achim Morschhauser's avatar
Achim Morschhauser committed
32
$(BIN_DIR)%: $(USR_DIR)%.cpp $(LIB_DIR)libLogger.so
Achim Morschhauser's avatar
Achim Morschhauser committed
33
34
	$(CC) $(CCFLAGS) -no-pie $< -o $@ -I$(HDR_DIR) -L$(LIB_DIR) -Wl,-rpath,"\$$ORIGIN/../$(LIB_DIR)" -lLogger
#	$(CC) $(CCFLAGS)  $< -o $@ -I$(HDR_DIR) -L$(LIB_DIR) -lLogger
35
36

$(OBJ_DIR)%.o: $(SRC_DIR)%.cpp
Achim Morschhauser's avatar
Achim Morschhauser committed
37
38
39
40
	$(CC) $(CCFLAGS) -fPIC -c -o $@ $< -I$(HDR_DIR)

$(LIB_DIR)libLogger.so: $(filter-out $(OBJ_DIR)$(EXCL) ,$(OBJ_FILES))
	$(CC) $^  -shared -o $@
41

Achim Morschhauser's avatar
Achim Morschhauser committed
42
clean:
Achim Morschhauser's avatar
Achim Morschhauser committed
43
44
45
	rm -f $(BIN_DIR)*
	rm -f $(OBJ_DIR)*
	rm -f $(LIB_DIR)libLogger.so