-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (22 loc) · 782 Bytes
/
Makefile
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
TARGET = main
SOURCE_FILES=$(TARGET).* *.hpp
# SOURCE_FILES=$(wildcard $(SOURCE_DIR)/*.c
CC=g++
C_FLAGS=-std=c++11
LD_FLAGS=-lX11 -lXt -pthread
OBJECTS=$(SOURCE_FILES:.cpp=.o)
#all: library.cpp main.cpp
# $@ evaluates to all
# $< evaluates to library.cpp
# $^ evaluates to library.cpp main.cpp
all: clean $(TARGET) run
$(TARGET):
$(CC) $(SOURCE_FILES) $(C_FLAGS) $(INCLUDE_FLAGS) $(LIBRARY_FLAGS) $(LD_FLAGS) -o $(TARGET)
run:
sh -c "LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$PWD/lib ./$(TARGET)" || true
libserial:
bash -c "gcc send_receive.c $(C_FLAGS) $(INCLUDE_FLAGS) $(LIBRARY_FLAGS) -lserialport -o send_receive && LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$$PWD/lib ./send_receive /dev/ttyUSB0 "
.c.o.cpp:
$(CC) $< -o $@
clean:
rm -rf $(SOURCE_DIR)/*.o $(TARGET) &>/dev/null