Compare commits

...

2 Commits

Author SHA1 Message Date
8f46a3518a Updated README 2023-03-25 10:43:18 -05:00
a0e4bc6814 Added 'clean' and 'uninstall' rules to Makefile 2023-03-25 10:43:11 -05:00
2 changed files with 46 additions and 8 deletions

View File

@@ -27,14 +27,26 @@ static:
.PHONY: install
ifndef PREFIX
PREFIX := /usr/local
PREFIX := /usr/local
endif
.PHONY: install
install: $(LIB_FILE)
install -d $(DESTDIR)$(PREFIX)/lib
install -m 755 $(LIB_FILE) $(DESTDIR)$(PREFIX)/lib
install -d $(DESTDIR)$(PREFIX)/include
install -m 644 easysock.h $(DESTDIR)$(PREFIX)/include
.PHONY: clean
clean:
rm *.o
rm $(LIB_FILE)
.PHONY: uninstall
uninstall:
rm $(DESTDIR)$(PREFIX)/lib/$(LIB_FILE)
rm $(DESTDIR)$(PREFIX)/include/easysock.h

View File

@@ -2,15 +2,41 @@
## An easy-to-use C socket library
*Easysock* is a single-file, easy-to-use socket library, that can be used for network programming in C. It has no dependencies other than the C standard library.
___
### Compiling
The library can be compiled using the provided Makefile.
```
make
```
There are a few optional targets, which enable specific functionality.
`allwarn - enable all warnings`
`debug - compile with 'debug' flag`
`static - compile as statically linked library - NOT IMPLEMENTED`
They can be used as follows:
`make [TARGET NAME]`
___
### Installation
The library can also be installed using the provided Mekfile.
```
make install
```
The `install` target supports two environment variables. `DESTDIR`, which specifies the installation directory, and `PREFIX` which specifies the installation prefix. They are used as follows:
`DESTDIR=/home/user PREFIX=/usr/local make install`
This will install the library file in `/home/user/usr/local/lib` and the header file in `/home/user/usr/local/include`.
___
### Usage
To use the library, simply include the header file:
```
#include <easysock.h>
...
```
and link the library:
` gcc example.c -o example -leasysock`
___
This file was written using [Dillinger](https://dillinger.io).