HUSTOJ分为前端和后端两部分 web和core。
后端又分为judge_client judged sim 三部分
然后本文写的是 core,judge_client,judged三个文件夹下面的makefile,(sim部分暂且还没看)读懂makefile可以有效的帮助你理解大体的运行流程。如果有好的见解,欢迎私聊我交流或者在下方评论 我的个人邮箱:1079938790@qq.com
#!/bin/bash
cd judged //进入到judged
make
chmod +x judged //对judged授予可执行权限
cp judged /usr/bin //复制judged到bin目录下
cd ../judge_client // 返回上一级后进入到judge_client
make
chmod +x judge_client //对judge_client授予可执行权限
cp judge_client /usr/bin //复制judge_client到bin目录下
cd ../sim/sim_3_01 //返回上一级后进入到sim_3_01
make fresh
make exes
chmod +x sim* //对sim作为前缀的文件授予可执行权限
cp sim_c.exe /usr/bin/sim_c //复制sim_c.exe到 /usr/bin/sim_c下
cp sim_c++.exe /usr/bin/sim_cc//复制sim_c++.exe到 /usr/bin/sim_cc下
cp sim_java.exe /usr/bin/sim_java //复制sim_java.exe 到/usr/bin/sim_java
cp sim_pasc.exe /usr/bin/sim_pas //复制sim_pasc.exe 到/usr/bin/sim_pas
cp sim_text.exe /usr/bin/sim_text //复制sim_text.exe 到/usr/bin/sim_text
cp sim_lisp.exe /usr/bin/sim_scm //复制sim_lisp.exe 到/usr/bin/sim_scm
cd ..
cp sim.sh /usr/bin //复制sim.sh 到/usr/bin
chmod +x /usr/bin/sim.sh //对该文件授予可执行权限
ln -fs /usr/bin/sim_c /usr/bin/sim_cc 2>&1 > /dev/null
echo "done!"
#judge_client/makefile
all: judge_client.cc
g++ -Wall -c -I/usr/local/mysql/include/mysql -I/usr/include/mysql judge_client.cc
g++ -Wall -o judge_client judge_client.o -L/usr/local/mysql/lib/mysql -L/usr/lib/mysql -L/usr/lib64/mysql -lmysqlclient
// -Wall编译后显示所有警告 -I将按照后面那个目录搜索头文件
//-L 编译程序按照-L指定的路进去寻找库文件
#judged/makefile
all: judged.cc
g++ -Wall -c -I/usr/local/mysql/include/mysql -I/usr/include/mysql judged.cc
g++ -Wall -o judged judged.o -L/usr/local/mysql/lib/mysql -L/usr/lib/mysql -L/usr/lib64/mysql -lmysqlclient