Skip to content

Commit 78f355d

Browse files
author
Daniel Kang
committed
moved all headers under native dir; updated Makefile; added webservere and webclient sample app
1 parent 50887e8 commit 78f355d

File tree

11 files changed

+20
-32
lines changed

11 files changed

+20
-32
lines changed

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
*.a
2-
*.o
3-
sample
4-
51
.cproject
62
.project
73
.settings/*
84

5+
webclient
6+
webserver
97

Makefile

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
1-
PROGNAME = sample
2-
LIBS = -lrt -lm -lpthread
3-
LIBUV_INC = $(LIBUV_PATH)/include
4-
HTTP_PARSER_INC = $(HTTP_PARSER_PATH)
5-
INCLUDES = -I$(LIBUV_INC) -I$(HTTP_PARSER_INC)
6-
LDFLAGS =
7-
OBJECTS = sample.o $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o
8-
CPPFLAGS = -std=gnu++0x
9-
CPPFLAGS_DEBUG = $(CPPFLAGS) -g -O0
1+
CXXFLAGS = -std=gnu++0x -g -O0 -I$(LIBUV_PATH)/include -I$(HTTP_PARSER_PATH) -I.
102

11-
all: env_req $(PROGNAME)
3+
all: webclient webserver
124

13-
$(PROGNAME): $(OBJECTS)
14-
g++ -o $(PROGNAME) $(OBJECTS) $(LIBS) $(INCLUDES) $(LDFLAGS)
15-
16-
$(OBJECTS): Makefile
5+
webclient: webclient.cpp $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o $(wildcard native/*.h)
6+
$(CXX) $(CXXFLAGS) -o webclient webclient.cpp $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o -lrt -lm -lpthread
7+
8+
webserver: webserver.cpp $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o $(wildcard native/*.h)
9+
$(CXX) $(CXXFLAGS) -o webserver webserver.cpp $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o -lrt -lm -lpthread
1710

1811
$(LIBUV_PATH)/uv.a:
1912
$(MAKE) -C $(LIBUV_PATH)
2013

2114
$(HTTP_PARSER_PATH)/http_parser.o:
2215
$(MAKE) -C $(HTTP_PARSER_PATH) http_parser.o
23-
24-
sample.o: sample.cpp $(wildcard *.h)
25-
g++ -c $(CPPFLAGS_DEBUG) $(INCLUDES) -o sample.o sample.cpp
26-
27-
env_req:
28-
ifndef LIBUV_PATH
29-
$(error Variable 'LIBUV_PATH' must be set to the path of libuv library.)
30-
endif
31-
ifndef HTTP_PARSER_PATH
32-
$(error Variable 'HTTP_PARSER_PATH' must be set to the path of http-parser library.)
33-
endif
34-
16+
3517
clean:
3618
rm -f $(LIBUV_PATH)/uv.a
3719
rm -f $(HTTP_PARSER_PATH)/http_parser.o
38-
rm *.o $(PROGNAME)
20+
rm -f webclient webserver
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

webclient.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <iostream>
2+
#include <native/http.h>
3+
using namespace native::http;
4+
5+
int main()
6+
{
7+
return native::run();
8+
}

0 commit comments

Comments
 (0)