Skip to content

Commit

Permalink
moved all headers under native dir; updated Makefile; added webserver…
Browse files Browse the repository at this point in the history
…e and webclient sample app
  • Loading branch information
d5 committed Feb 6, 2012
1 parent 50887e8 commit 78f355d
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 32 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
*.a
*.o
sample

.cproject
.project
.settings/*

webclient
webserver

36 changes: 9 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,20 @@
PROGNAME = sample
LIBS = -lrt -lm -lpthread
LIBUV_INC = $(LIBUV_PATH)/include
HTTP_PARSER_INC = $(HTTP_PARSER_PATH)
INCLUDES = -I$(LIBUV_INC) -I$(HTTP_PARSER_INC)
LDFLAGS =
OBJECTS = sample.o $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o
CPPFLAGS = -std=gnu++0x
CPPFLAGS_DEBUG = $(CPPFLAGS) -g -O0
CXXFLAGS = -std=gnu++0x -g -O0 -I$(LIBUV_PATH)/include -I$(HTTP_PARSER_PATH) -I.

all: env_req $(PROGNAME)
all: webclient webserver

$(PROGNAME): $(OBJECTS)
g++ -o $(PROGNAME) $(OBJECTS) $(LIBS) $(INCLUDES) $(LDFLAGS)

$(OBJECTS): Makefile
webclient: webclient.cpp $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o $(wildcard native/*.h)
$(CXX) $(CXXFLAGS) -o webclient webclient.cpp $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o -lrt -lm -lpthread

webserver: webserver.cpp $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o $(wildcard native/*.h)
$(CXX) $(CXXFLAGS) -o webserver webserver.cpp $(LIBUV_PATH)/uv.a $(HTTP_PARSER_PATH)/http_parser.o -lrt -lm -lpthread

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

$(HTTP_PARSER_PATH)/http_parser.o:
$(MAKE) -C $(HTTP_PARSER_PATH) http_parser.o

sample.o: sample.cpp $(wildcard *.h)
g++ -c $(CPPFLAGS_DEBUG) $(INCLUDES) -o sample.o sample.cpp

env_req:
ifndef LIBUV_PATH
$(error Variable 'LIBUV_PATH' must be set to the path of libuv library.)
endif
ifndef HTTP_PARSER_PATH
$(error Variable 'HTTP_PARSER_PATH' must be set to the path of http-parser library.)
endif


clean:
rm -f $(LIBUV_PATH)/uv.a
rm -f $(HTTP_PARSER_PATH)/http_parser.o
rm *.o $(PROGNAME)
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.
8 changes: 8 additions & 0 deletions webclient.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <iostream>
#include <native/http.h>
using namespace native::http;

int main()
{
return native::run();
}
2 changes: 1 addition & 1 deletion sample.cpp → webserver.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <iostream>
#include "http.h"
#include <native/http.h>
using namespace native::http;

int main()
Expand Down

0 comments on commit 78f355d

Please sign in to comment.