Skip to content

Commit

Permalink
📝 update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
markparticle committed Jun 28, 2020
1 parent fde49f2 commit 1cba332
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
!*.h
!LICENSE
!makefile
!Makefile

*.o
*.1
*.log
*.exe
/.vscode
/source.cpp
/source.h
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
all:
mkdir -p bin
cd build && make
18 changes: 18 additions & 0 deletions build/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#heaptimer.cpp
CXX = g++
CFLAGS = -std=c++14 -O2 -Wall -g

TARGET = server
OBJS = ../code/log/*.cpp ../code/pool/*.cpp ../code/timer/*.cpp \
../code/http/*.cpp ../code/server/*.cpp \
../code/buffer/*.cpp ../code/main.cpp

all: $(OBJS)
$(CXX) $(CFLAGS) $(OBJS) -o ../bin/$(TARGET) -pthread -lmysqlclient

clean:
rm -rf ../bin/$(OBJS) $(TARGET)




5 changes: 5 additions & 0 deletions code/config/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* @Author : mark
* @Date : 2020-06-28
* @copyleft GPL 2.0
*/
1 change: 0 additions & 1 deletion resources/html/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
</form>
<br/>
<form action="7" method="post">
<div align="center"><button type="submit">关注我</button></div>
</form>

</div>
Expand Down
17 changes: 17 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CXX = g++
CFLAGS = -std=c++14 -O2 -Wall -g

TARGET = server
OBJS = ../code/log/*.cpp ../code/pool/*.cpp ../code/timer/*.cpp \
../code/http/*.cpp ../code/server/*.cpp \
../code/buffer/*.cpp ../code/main.cpp

all: $(OBJS)
$(CXX) $(CFLAGS) $(OBJS) -o ../bin/$(TARGET) -pthread -lmysqlclient

clean:
rm -rf ../bin/$(OBJS) $(TARGET)




1 change: 1 addition & 0 deletions test/read.me
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
单元测试
4 changes: 2 additions & 2 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

void TestLog() {
int cnt = 0, level = 0;
Log::Instance()->init(level, "./test/testlog1", ".log", 0);
Log::Instance()->init(level, "./log//testlog1", ".log", 0);
for(level = 3; level >= 0; level--) {
Log::Instance()->SetLevel(level);
for(int j = 0; j < 100000; j++ ){
Expand All @@ -17,7 +17,7 @@ void TestLog() {
}
}
cnt = 0;
Log::Instance()->init(level, "./test/testlog2", ".log", 5000);
Log::Instance()->init(level, "./log/testlog2", ".log", 5000);
for(level = 0; level < 4; level++) {
Log::Instance()->SetLevel(level);
for(int j = 0; j < 100000; j++ ){
Expand Down
40 changes: 40 additions & 0 deletions webbench-1.5/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
CFLAGS?= -Wall -ggdb -W -O
CC?= gcc
LIBS?=
LDFLAGS?=
PREFIX?= /usr/local
VERSION=1.5
TMPDIR=/tmp/webbench-$(VERSION)

all: webbench tags

tags: *.c
-ctags *.c

install: webbench
install -s webbench $(DESTDIR)$(PREFIX)/bin
install -m 644 webbench.1 $(DESTDIR)$(PREFIX)/man/man1
install -d $(DESTDIR)$(PREFIX)/share/doc/webbench
install -m 644 debian/copyright $(DESTDIR)$(PREFIX)/share/doc/webbench
install -m 644 debian/changelog $(DESTDIR)$(PREFIX)/share/doc/webbench

webbench: webbench.o Makefile
$(CC) $(CFLAGS) $(LDFLAGS) -o webbench webbench.o $(LIBS)

clean:
-rm -f *.o webbench *~ core *.core tags

tar: clean
-debian/rules clean
rm -rf $(TMPDIR)
install -d $(TMPDIR)
cp -p Makefile webbench.c socket.c webbench.1 $(TMPDIR)
install -d $(TMPDIR)/debian
-cp -p debian/* $(TMPDIR)/debian
ln -sf debian/copyright $(TMPDIR)/COPYRIGHT
ln -sf debian/changelog $(TMPDIR)/ChangeLog
-cd $(TMPDIR) && cd .. && tar cozf webbench-$(VERSION).tar.gz webbench-$(VERSION)

webbench.o: webbench.c socket.c Makefile

.PHONY: clean install all tar

0 comments on commit 1cba332

Please sign in to comment.