Makefile.static 896 Bytes
Newer Older
Achim Morschhauser's avatar
Achim Morschhauser committed
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
SRC_DIR=./src/
OBJ_DIR=./lib/
HDR_DIR=./include/

USR_DIR=./usr/
BIN_DIR=./bin/

#--------------------------------------
#--------------------------------------
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))
#--------------------------------------
CC=g++

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

EXCL=driver_serial_emulate.o
# Uncomment to use virtual serial port. Run 'make clean all' afterwards
#EXCL=driver_serial.o

.SECONDARY:

all: $(USR_TARGET:%=$(BIN_DIR)%)

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


$(BIN_DIR)%: $(filter-out $(OBJ_DIR)$(EXCL) ,$(OBJ_FILES)) $(USR_DIR)%.cpp
	$(CC) $(CCFLAGS) -o $(@) $^ -I./include/

$(OBJ_DIR)%.o: $(SRC_DIR)%.cpp
	$(CC) $(CCFLAGS) -c -o $@ $< -I$(HDR_DIR)

clean:
	rm $(BIN_DIR)*
	rm $(OBJ_DIR)*