目录
3.1 ./src/arm_api/Globle_Def.h:3:10: fatal error: QDateTime: No such file or directory 3 | #include
3.2 src/Lamp_Control.cpp:5:10: fatal error: wiringPi.h: No such file or directory
3.3 src/LaserStereo.h:3:10: fatal error: opencv2/opencv.hpp: No such file or directory
3.4 multiple definition of `validROIL
3.5 ./src/thread/motor_control.h:7:10: fatal error: QSerialPort: No such file or directory
3.6 undefined reference to `QCoreApplication::QCoreApplication(int&, char**, int)'
3.7 undefined reference to `cv::cvtColor(cv::_I
3.8 error: ‘stime’ was not declared in this scope; did
3.9 src/arm_api/camera_reader.cpp:14:10: fatal error: rk_mpi.h: No such file or directory
3.10 undefined reference to `QSerialPortInfo::~QSerialPortInfo()'
3.11 /usr/bin/ld: ./lib/libturing.so: undefined reference to `digitalWrite'
3.12 undefined reference to `vtable for Transmit_Point'
同事有一个工程,在RK3588上面编译,这个代码最开始是用qtcreator进行编译的,我现在直接自己写makefile进行编译,下面记录下过程中遇到的问题。
1 硬件环境问题
首先是这个开发板连接电脑之后,发现屏幕不正常,然后我需要想办法连接开发板,然后用串口线,在使用串口连接开发板的时候遇到了问题,然后采用了下面几个方法,最终连上了,
- 开发板的DEBUG口太小了,我的三根杜邦线插不上,于是我把其中一根杜邦线的塑料减掉,只保留铁,就能连上了。
- 插上之后还是没东西,于是把波特率由115200换成150000,
- 波特率换了还不行,我又换了个串口小板
- 小板换了还不行,我交叉RX TX的位置,发现是官方给的说明图有误。
当串口能连上之后发现可以打印了,但是串口没法输入命令,
于是我直接想刷机,然后就找刷机方法。在刷机的时候看到了adb,于是采用adb的方式发现能连接上开发板,并且能输入命令,但是这时候根目录太大,先是删了两万多个log文件,
然后开始刷机,刷机方法在:2. 使用USB线缆升级固件 — Firefly Wiki
2 编写初版makefile
CC = gcc
CPP = g++
AR = ar
RM = rm -f
#Define the resource compiler.
RC = windres
## debug flag
DBG_ENABLE := 1
OS = $(shell uname)
## source file path
SRC_PATH := ./src/ ./src/thread ./src/arm_api ./src/arm_api/rtsp
SRC_PATH_EXT :=
DEMO :=./main.cpp
## target file name
TARGET := turing
DEMO_TARGET := usb_2eye
## get all source files
SRCS := $(foreach spath, $(SRC_PATH), $(wildcard $(spath)*.c) $(wildcard $(spath)*.cpp))
## all .o based on all .c/.cpp
OBJS = $(SRCS:.c=.o)
OBJS := $(OBJS:.cpp=.o)
## macro define
DEFS := __LINUX__ OS_LINUX _FILE_OFFSET_BITS=64
#if freeimage is static-linked use this !
#DEFS += FREEIMAGE_LIB
## need libs, add at here
LIBS := gxiapi
DEMO_LIBS = $(LIBS)
DEMO_LIBS += turing
## used headers file path
INCLUDE_PATH := ./include ./src/ ./src/thread ./src/arm_api ./src/arm_api/rtsp /usr/include/aarch64-linux-gnu/qt5/QtCore/
INCLUDE_PATH += /usr/include/aarch64-linux-gnu/qt5/
#$(warning $(INCLUDE_PATH))
## used include librarys file path
LIBRARY_PATH := ./lib
## debug for debug info, when use gdb to debug
ifeq (1, ${DBG_ENABLE})
CFLAGS += -D_DEBUG -g -DDEBUG=1
else
CFLAGS += -O2 -DNDEBUG
endif
#for ENCYPT flags
ifeq ($(OS), Linux)
LIBS += dl rt
CFLAGS += -fPIC
TARGET_EXT := .so
LIBRARY_PATH +=
LDFLAGS += -Wl,--rpath=./libs
endif
#CFLAGS += -msse4.2 -march=core2 -pipe $(foreach m, $(DEFS), -D$(m))
#CFLAGS += -march=armv8.2-a -pipe $(foreach m, $(DEFS), -D$(m))
CFLAGS += -march=armv8-a -pipe $(foreach m, $(DEFS), -D$(m))
## get all include path
CFLAGS += $(foreach dir, $(INCLUDE_PATH), -I$(dir))
CXXFLAGS += $(CFLAGS) -std=c++11
## get all library path
LDFLAGS += -lpthread $(foreach lib, $(LIBRARY_PATH), -L$(lib))
DEMO_LDFLAGS := $(LDFLAGS)
## get all librarys
LDFLAGS += $(foreach lib, $(LIBS), -l$(lib))
DEMO_LDFLAGS += $(foreach lib, $(DEMO_LIBS), -l$(lib))
RCFLAGS ?= -DNDEBUG
default: all
%.o: %.c
$(CC) $(CFLAGS) -g -c $< -o $@
%.o: %.cpp
$(CPP) $(CXXFLAGS) -g -c $< -o $@
all: $(OBJS) $(RESOURCE)
#$(CPP) $(CXXFLAGS) -o $(TARGET) $(OBJS) $(RESOURCE) $(LDFLAGS)
$(CPP) $(CXXFLAGS) -g -shared -o lib$(TARGET)$(TARGET_EXT) $(OBJS) $(RESOURCE) $(LDFLAGS)
mv libturing.so ./lib
$(CPP) $(CXXFLAGS) -g -o $(DEMO_TARGET) $(DEMO) $(DEMO_LDFLAGS)
clean:
$(RM) $(OBJS) $(DEMO_TARGET) $(TARGET).* $(RESOURCE)
3 编译程序
3.1 ./src/arm_api/Globle_Def.h:3:10: fatal error: QDateTime: No such file or directory
3 | #include <QDateTime>
这种错误直接在makefile中增加头文件解决。
3.2 src/Lamp_Control.cpp:5:10: fatal error: wiringPi.h: No such file or directory
https://github.com/WiringPi/WiringPi/releases
去这个地方直接下载deb包,然后安装
apt install ./wiringpi_3.14_arm64.deb
这个版本太新了,
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/libwiringPi.so: undefined reference to `pthread_join@GLIBC_2.34'
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/libwiringPi.so: undefined reference to `stat@GLIBC_2.33'
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/libwiringPi.so: undefined reference to `shm_open@GLIBC_2.34'
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/libwiringPi.so: undefined reference to `pthread_create@GLIBC_2.34'
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/libwiringPi.so: undefined reference to `pthread_cancel@GLIBC_2.34'
后面会编译报错,所以用2.61版本
apt install ./wiringpi-2.61-1-arm64.deb
编译不报错了,但是我需要给我同事写个这样的注释
//cumtchw
/*************************************************************************************************************
这是树莓派操作GPIO的库,可能以前的rk3399开发板买的是树莓派的,所以可以直接用这个库进行操作gpio管脚,
从而控制激光器,我这次也在firefly的rk3588上装上这个库了,但是不一定能用,如果用不了可以先尝试用类似下面的方案
system("echo su");
system("echo 421 >/sys/class/gpio/export"); //这个421序号需要根据用哪个管脚,然后计算出来这个管脚的序号,
system("echo out >/sys/class/gpio/gpio421/direction");
system("echo 0 >/sys/class/gpio/gpio421/value");
上面的命令相当于是在用户程序中直接管脚,会慢,因为需要再用户和内核空间进行切换,但是不是高频使用问题不大,如果想效率高,
那么就修改设备树,然后写驱动程序,
修改设备树参考
https://wiki.t-firefly.com/zh_CN/iCore-3588Q/usage_gpio.html#
这个网址的方法进行操作,这个对需要会设备树,以及编译下载设备树,还要写驱动程序
**************************************************************************************************************/
3.3 src/LaserStereo.h:3:10: fatal error: opencv2/opencv.hpp: No such file or directory
这个先执行 apt install libopencv-dev,然后makefile中增加INCLUDE_PATH += /usr/include/opencv4/
3.4 multiple definition of `validROIL
这是因为有两个cpp,把old那个给注释掉。
改成这样的后缀就不会编译了,.o也删掉。
3.5 ./src/thread/motor_control.h:7:10: fatal error: QSerialPort: No such file or directory
n file included from ./src/thread/measure.h:18,
from ./main.cpp:12:
./src/thread/motor_control.h:7:10: fatal error: QSerialPort: No such file or directory
7 | #include <QSerialPort>
| ^~~~~~~~~~~~~
compilation terminated.
make: *** [makefile:102: all] Error 1
root@firefly:/data/usb_2eye_0514# find / -iname QSerialPort
find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/proc/1458/task/1458/net’: Invalid argument
find: ‘/proc/1458/net’: Invalid argument
find: ‘/proc/173747’: No such file or directory
这个我搜索直接没有,说明是我安装qt版本不高,可能没这个模块,可是网上查着5.1就已经有这个模块了,我的都已经是5.12了
qmake --version
QMake version 3.1
Using Qt version 5.12.8 in /usr/lib/aarch64-linux-gnu
解决方法是用下面的命令安装
sudo apt-get install libqt5serialport5-dev libudev-dev
然后就能搜到了,把路径加到makefile中,
3.6 undefined reference to `QCoreApplication::QCoreApplication(int&, char**, int)'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:22: undefined reference to `QMessageLogger::debug(char const*, ...) const'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:23: undefined reference to `QMessageLogger::debug(char const*, ...) const'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:25: undefined reference to `Setting_File::Setting_File()'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:25: undefined reference to `p_setting_file'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:25: undefined reference to `p_setting_file'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:28: undefined reference to `get_ssd_size()'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:30: undefined reference to `QMessageLogger::debug() const'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:30: undefined reference to `QDebug::~QDebug()'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:34: undefined reference to `QMessageLogger::debug() const'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:34: undefined reference to `QDebug::~QDebug()'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:45: undefined reference to `Camera_Thread::Camera_Thread()'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:45: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:45: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:46: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:46: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:46: undefined reference to `Camera_Thread::set_camera_idx(int)'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:47: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:47: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:47: undefined reference to `QThread::start(QThread::Priority)'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:49: undefined reference to `Camera_Thread::Camera_Thread()'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:49: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:49: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:50: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:50: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:50: undefined reference to `Camera_Thread::set_camera_idx(int)'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:51: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:51: undefined reference to `p_IP_Camera_Thread'
/usr/bin/ld: /data/usb_2eye_0514/./main.cpp:51: undefined reference to `QThread::start(QThread::Priority)'
这明显就是库没有加上,把qt库加到makefile中。
3.7 undefined reference to `cv::cvtColor(cv::_I
同样的道理,opencv的库没加上
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::initUndistortRectifyMap(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, int, cv::_OutputArray const&, cv::_OutputArray const&)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::FileStorage::~FileStorage()'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::medianBlur(cv::_InputArray const&, cv::_OutputArray const&, int)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::remap(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&, int, int, cv::Scalar_<double> const&)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::eigen(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::filter2D(cv::_InputArray const&, cv::_OutputArray const&, int, cv::_InputArray const&, cv::Point_<int>, double, int)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::FileStorage::operator[](char const*) const'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::reprojectImageTo3D(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, bool, int)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::read(cv::FileNode const&, cv::Mat&, cv::Mat const&)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::VideoCapture::VideoCapture(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::Mat::deallocate()'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `pinMode'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `cv::FileStorage::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
opencv_core opencv_calib3d opencv_imgproc opencv_imgcodecs opencv_videoio opencv_video opencv_stereo
3.8 error: ‘stime’ was not declared in this scope; did
src/thread/receiver_net.cpp:590:13: error: ‘stime’ was not declared in this scope; did you mean ‘ctime’?
590 | int r = stime(&tt);
修改成
struct timespec ts;
ts.tv_sec = tt; // tt 是你的 time_t 变量
ts.tv_nsec = 0; // 纳秒设为 0
int r = clock_settime(CLOCK_REALTIME, &ts);
3.9 src/arm_api/camera_reader.cpp:14:10: fatal error: rk_mpi.h: No such file or directory
解决方法老样子
root@firefly:/data/usb_2eye_0514# find / -iname rk_mpi.h
/usr/include/rockchip/rk_mpi.h
find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/proc/1458/task/1458/net’: Invalid argument
find: ‘/proc/1458/net’: Invalid argument
find: ‘/proc/182288’: No such file or directory
/root-ro/usr/include/rockchip/rk_mpi.h
3.10 undefined reference to `QSerialPortInfo::~QSerialPortInfo()'
解决方法
LIBS += Qt5Widgets Qt5Core Qt5Gui Qt5SerialPort Qt5Network
3.11 /usr/bin/ld: ./lib/libturing.so: undefined reference to `digitalWrite'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `digitalWrite'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `wiringPiSetup'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `pinMode'
这是哪个树莓派的库wiringPi,在rk3588上能不能用另说,先加上看看报错还在不在
3.12 undefined reference to `vtable for Transmit_Point'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `vtable for Transmit_Point'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `vtable for Measure'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `vtable for Motor_Control'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `vtable for receiver_net'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `vtable for Camera_Thread'
/usr/bin/ld: ./lib/libturing.so: undefined reference to `vtable for Cycle_Timing'
这个的原因是
所以在makefile中增加如下内容
# 1. 定义需要 moc 处理的头文件(自动扫描 ./src/thread/ 下所有含 Q_OBJECT 的 .h 文件)
MOC_HEADERS := $(shell find ./src/thread/ -name "*.h" -exec grep -l "Q_OBJECT" {} +)
# 2. 生成对应的 moc_*.cpp 文件名
MOC_SRCS := $(addprefix moc_, $(notdir $(MOC_HEADERS:.h=.cpp)))
MOC_OBJS := $(MOC_SRCS:.cpp=.o)
# 3. 添加 moc 生成规则
moc_%.cpp: ./src/thread/%.h
moc $(MOC_INCLUDES) $< -o $@
# 4. 将 moc 生成的文件加入编译系统
SRCS += $(MOC_SRCS)
OBJS += $(MOC_OBJS)
# 5. 确保 Qt 头文件路径被包含
MOC_INCLUDES := -I/usr/include/qt5 -I/usr/include/aarch64-linux-gnu/qt5
CXXFLAGS += $(MOC_INCLUDES)
4 最后完整版的makefile
CC = gcc
CPP = g++
AR = ar
RM = rm -f
#Define the resource compiler.
RC = windres
## debug flag
DBG_ENABLE := 1
OS = $(shell uname)
## source file path
SRC_PATH := ./src/ ./src/thread/ ./src/arm_api/ ./src/arm_api/rtsp/
SRC_PATH_EXT :=
DEMO :=./main.cpp
## target file name
TARGET := turing
DEMO_TARGET := usb_2eye
## get all source files
SRCS := $(foreach spath, $(SRC_PATH), $(wildcard $(spath)*.c) $(wildcard $(spath)*.cpp))
## all .o based on all .c/.cpp
OBJS = $(SRCS:.c=.o)
OBJS := $(OBJS:.cpp=.o)
$(info Source files: $(SRCS))
## macro define
DEFS := __LINUX__ OS_LINUX _FILE_OFFSET_BITS=64
#if freeimage is static-linked use this !
#DEFS += FREEIMAGE_LIB
## need libs, add at here
LIBS := gxiapi
LIBS += Qt5Core Qt5Widgets Qt5Core Qt5Gui Qt5SerialPort Qt5Network
LIBS += opencv_core opencv_calib3d opencv_imgproc opencv_imgcodecs opencv_videoio opencv_video opencv_stereo
LIBS += wiringPi #cumtchw,树莓派的gpio操作库,这里为了编译不报错先加上,至于能不能再rk3588上用,需要测试,
DEMO_LIBS = $(LIBS)
DEMO_LIBS += turing
## used headers file path
INCLUDE_PATH := ./include ./src/ ./src/thread ./src/arm_api ./src/arm_api/rtsp
INCLUDE_PATH += /usr/include/aarch64-linux-gnu/qt5/ /usr/include/aarch64-linux-gnu/qt5/QtCore/ /usr/include/aarch64-linux-gnu/qt5/QtSerialPort/
INCLUDE_PATH += /usr/include/aarch64-linux-gnu/qt5/QtNetwork
INCLUDE_PATH += /usr/include/opencv4/
INCLUDE_PATH += /usr/include/rockchip/
#$(warning $(INCLUDE_PATH))
## used include librarys file path
LIBRARY_PATH := ./lib /usr/lib/aarch64-linux-gnu/
## debug for debug info, when use gdb to debug
ifeq (1, ${DBG_ENABLE})
CFLAGS += -D_DEBUG -g -DDEBUG=1
else
CFLAGS += -O2 -DNDEBUG
endif
#for ENCYPT flags
ifeq ($(OS), Linux)
LIBS += dl rt
CFLAGS += -fPIC
TARGET_EXT := .so
LIBRARY_PATH +=
LDFLAGS += -Wl,--rpath=./libs
endif
#CFLAGS += -msse4.2 -march=core2 -pipe $(foreach m, $(DEFS), -D$(m))
#CFLAGS += -march=armv8.2-a -pipe $(foreach m, $(DEFS), -D$(m))
CFLAGS += -march=armv8-a -pipe $(foreach m, $(DEFS), -D$(m))
## get all include path
CFLAGS += $(foreach dir, $(INCLUDE_PATH), -I$(dir))
CXXFLAGS += $(CFLAGS) -std=c++11
## get all library path
LDFLAGS += -lpthread $(foreach lib, $(LIBRARY_PATH), -L$(lib))
DEMO_LDFLAGS := $(LDFLAGS)
## get all librarys
LDFLAGS += $(foreach lib, $(LIBS), -l$(lib))
DEMO_LDFLAGS += $(foreach lib, $(DEMO_LIBS), -l$(lib))
RCFLAGS ?= -DNDEBUG
# 1. 定义需要 moc 处理的头文件(自动扫描 ./src/thread/ 下所有含 Q_OBJECT 的 .h 文件)
MOC_HEADERS := $(shell find ./src/thread/ -name "*.h" -exec grep -l "Q_OBJECT" {} +)
# 2. 生成对应的 moc_*.cpp 文件名
MOC_SRCS := $(addprefix moc_, $(notdir $(MOC_HEADERS:.h=.cpp)))
MOC_OBJS := $(MOC_SRCS:.cpp=.o)
# 3. 添加 moc 生成规则
moc_%.cpp: ./src/thread/%.h
moc $(MOC_INCLUDES) $< -o $@
# 4. 将 moc 生成的文件加入编译系统
SRCS += $(MOC_SRCS)
OBJS += $(MOC_OBJS)
# 5. 确保 Qt 头文件路径被包含
MOC_INCLUDES := -I/usr/include/qt5 -I/usr/include/aarch64-linux-gnu/qt5
CXXFLAGS += $(MOC_INCLUDES)
default: all
%.o: %.c
$(CC) $(CFLAGS) -g -c $< -o $@
%.o: %.cpp
$(CPP) $(CXXFLAGS) -g -c $< -o $@
all: $(OBJS) $(RESOURCE)
#$(CPP) $(CXXFLAGS) -o $(TARGET) $(OBJS) $(RESOURCE) $(LDFLAGS)
$(CPP) $(CXXFLAGS) -g -shared -o lib$(TARGET)$(TARGET_EXT) $(OBJS) $(RESOURCE) $(LDFLAGS)
mv libturing.so ./lib
$(CPP) $(CXXFLAGS) -g -o $(DEMO_TARGET) $(DEMO) $(DEMO_LDFLAGS)
clean:
$(RM) $(OBJS) $(DEMO_TARGET) $(TARGET).* $(RESOURCE)