refactor-into-dirs.patch

Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
Andy Green 2010-11-01 09:12:17 +00:00
parent 05a0a7b02e
commit 7310e9c77b
11 changed files with 49 additions and 18 deletions

View file

@ -1,16 +1,17 @@
CFLAGS= -Wall -Werror -rdynamic -fPIC -c
export CFLAGS= -Wall -Werror -rdynamic -fPIC -c
all:
gcc $(CFLAGS) libwebsockets.c
gcc $(CFLAGS) md5.c
gcc libwebsockets.o md5.o --shared -o libwebsockets.so
gcc $(CFLAGS) test-server.c
gcc test-server.o ./libwebsockets.so -o test-server
./kernel-doc -text libwebsockets.c test-server.c > \
libwebsockets-api-doc.txt
make -C lib
make -C test-server
./scripts/kernel-doc -text \
./lib/libwebsockets.c \
./test-server/test-server.c > libwebsockets-api-doc.txt
clean:
rm -f *.o *.so test-server
make -C lib clean
make -C test-server clean
install:
make -C lib install
make -C test-server install

View file

@ -2,7 +2,8 @@ Using test-server as a quickstart
---------------------------------
$ make
$ ./test-server
$ sudo make install
$ libwebsockets-test-server
should be enough to get a test server listening on port 7861.
@ -10,9 +11,9 @@ If you point your browser (eg, Chrome) to
http://127.0.0.1:7681
It will fetch "test.html", and then run the script in there
on the browser to open a websocket connection. Incrementing
numbers should appear in the browser display.
It will fetch "./test-server/test.html", and then run the
script in there on the browser to open a websocket connection.
Incrementing numbers should appear in the browser display.
test-server.c is all that is needed to use libwebsockets for
serving both the script html over http and websockets.

15
lib/Makefile Normal file
View file

@ -0,0 +1,15 @@
export LDIR=$(shell if [ -z "gcc --print-search-dirs | grep libraries | sed s/\\//\\n/g | grep lib64 | grep 64 | head -n1" ] ; then echo lib; else echo lib64 ; fi )
all:
gcc $(CFLAGS) libwebsockets.c
gcc $(CFLAGS) md5.c
gcc libwebsockets.o md5.o --shared -o libwebsockets.so
clean:
rm -f *.o *.so
install:
cp -rf libwebsockets.so $(DESTDIR)/usr/$(LDIR)
cp -rf libwebsockets.h $(DESTDIR)/usr/include

View file

14
test-server/Makefile Normal file
View file

@ -0,0 +1,14 @@
all:
gcc $(CFLAGS) test-server.c
gcc test-server.o \
-L ../lib \
-lwebsockets \
-o libwebsockets-test-server
clean:
rm -f *.o libwebsockets-test-server
install:
cp -f libwebsockets-test-server $(DESTDIR)/usr/bin

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -4,7 +4,7 @@
#include <getopt.h>
#include <string.h>
#include "libwebsockets.h"
#include "../lib/libwebsockets.h"
/*
* libwebsocket Example server Copyright 2010 Andy Green <andy@warmcat.com>

View file

@ -30,7 +30,7 @@
function got_packet(msg){
// alert('got packet' + msg.data);
document.write(msg.data + "\n");
document.body.textContent = msg.data + "\n";
}
</script>