diff --git a/Makefile b/Makefile index be4379d..7159532 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ EXECUTABLE = demo -SHARED_LIB = libprogressbar.so -STATIC_LIB = libprogressbar.a +#SHARED_LIB = libprogressbar.so +#STATIC_LIB = libprogressbar.a SRC=lib INCLUDE=include/progressbar @@ -9,7 +9,7 @@ CFLAGS += -std=c99 -I$(INCLUDE) -Wimplicit-function-declaration -Wall -Wextra -p CFLAGS_DEBUG = -g -O0 LDLIBS = -lncurses -all: $(EXECUTABLE) $(SHARED_LIB) $(STATIC_LIB) +all: $(EXECUTABLE) libprogressbar.so libprogressbar.a libstatusbar.so libstatusbar.a debug: CFLAGS += $(CFLAGS_DEBUG) debug: $(EXECUTABLE) @@ -25,6 +25,15 @@ libprogressbar.so: $(INCLUDE)/progressbar.h $(SRC)/progressbar.c libprogressbar.a: libprogressbar.a(progressbar.o) +libstatusbar.so: $(INCLUDE)/statusbar.h $(SRC)/statusbar.c + $(CC) -fPIC -shared -o $@ -c $(CFLAGS) $(CPPFLAGS) $(SRC)/statusbar.c + +libstatusbar.a: libstatusbar.a(statusbar.o) + +install: + cp libprogressbar.* libstatusbar.* /usr/local/lib + cp -r include/progressbar /usr/local/include + %.o: $(SRC)/%.c $(INCLUDE)/%.h $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ @@ -34,5 +43,5 @@ demo.o: $(TEST)/demo.c .PHONY: clean clean: - rm -f *.o $(EXECUTABLE) $(SHARED_LIB) $(STATIC_LIB) + rm -f *.o $(EXECUTABLE) $libprogressbar.so libprogressbar.a libstatusbar.so libstatusbar.a rm -rf doc diff --git a/README.mdown b/README.mdown index 2f6daea..571cb4e 100644 --- a/README.mdown +++ b/README.mdown @@ -1,8 +1,8 @@ ## What is this thing? -progressbar is a C-class (it's a convention, dammit) for displaying attractive -progress bars on the command line. It's heavily influenced by the ruby ProgressBar -gem, whose api and behaviour it imitates. +![GIF created with `ttygif`](./example_output/demo.gif) + +`progressbar` is a C-class (it's a convention, dammit) for displaying attractive progress bars on the command line. It's heavily influenced by the ruby `ProgressBar` gem, whose api and behavior it imitates. ## Ok, what the hell is a C-class, and how do I use one? @@ -34,15 +34,31 @@ a tool to handle some long-running, processor-intensive task, I'd really like to have a way of seeing at a glance how much time is remaining and how far along we've gotten. Enter progressbar! -## Can I use it? +## How to use it -Of course, if you're so inclined. progressbar is licensed under a simplified BSD license, -so feel free to take it and run with it. Details can be found in the `LICENSE` file. +First install the `progressbar` libraries for progress and status bars: + +1. `git clone PATH-TO-PROGRESSBAR` (replace path with git path) +2. `make` +3. `sudo make install` + +How to compile your custom code and make use of `progressbar`: + + gcc -lncurses -lprogressbar -lstatusbar YOURCODE.C -o YOURCODE -## Why doesn't it compile? +If your `gcc` search path does not look up `/usr/local/include`, try this: -If progressbar fails to build because `termcap.h` isn't found, you're probably missing the ncurses dev libraries. + gcc -I/usr/local/include/progressbar -lncurses -lprogressbar -lstatusbar YOURCODE.C -o YOURCODE + +## Troubleshooting + +If progressbar fails to build because `termcap.h` isn't found, you're probably missing the `ncurses dev` libraries. gcc -c -std=c99 -Iinclude lib/progressbar.c lib/progressbar.c:13:45: fatal error: termcap.h: No such file or directory compilation terminated. + +## LICENSE + +Of course, if you're so inclined. `progressbar` is licensed under a simplified BSD license, +so feel free to take it and run with it. Details can be found in the `LICENSE` file. diff --git a/example_output/demo.gif b/example_output/demo.gif new file mode 100644 index 0000000..231d141 Binary files /dev/null and b/example_output/demo.gif differ