diff --git a/Makefile b/Makefile index a012c00..060a0a2 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,18 @@ C_SOURCES = $(wildcard src/*.c) HEADERS = $(wildcard src/*.h) -HEADERS += $(wildcard src/models/*.h) OBJ = ${C_SOURCES:.c=.o} CFLAGS = -Wall CC=gcc -all: cbrain +all: libcbrain.so %.o: %.c - $(CC) -c $< -o $@ $(CFLAGS) + $(CC) -c $< -o $@ $(CFLAGS) -fPIC -cbrain: ${OBJ} - $(CC) $^ -o $@ -lpthread $(CFLAGS) - strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag $@ +libcbrain.so: ${OBJ} + $(CC) -shared -o $@ -lpthread $(CFLAGS) $^ clean: - rm cbrain rm src/*.o + rm libcbrain.so + diff --git a/README.md b/README.md index 169b21e..565de29 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,9 @@ Simple implementation of neural structure in c. git clone https://github.com/Auxilus/cbrain -the main() lies in src/cbrain.c -make your changes to main() - make -./cbrain - +This will generate shared object **libcbrain.so** +You need to copy **libcbrain.so** and **src/cbrain.h** over to lib and include dirs All the bugs and PRs are welcome! diff --git a/src/cbrain.c b/examples/cbrain.c similarity index 94% rename from src/cbrain.c rename to examples/cbrain.c index 8deeb73..478df64 100644 --- a/src/cbrain.c +++ b/examples/cbrain.c @@ -1,4 +1,4 @@ -#include "header.h" +#include int main(int argc, char* argv[]) { @@ -16,7 +16,7 @@ int main(int argc, char* argv[]) uint sleep_t; sleep_t = (argc < 3) ? SLEEP_T : strtof(argv[2], NULL); - struct brain* b = parse_model_csv("src/models/conn.txt"); + struct brain* b = parse_model_csv("models/conn.txt"); //struct brain* b = brain_init((uint)neurons_no); //neuron_link_random(b); diff --git a/src/models/conn.txt b/examples/models/conn.txt similarity index 100% rename from src/models/conn.txt rename to examples/models/conn.txt diff --git a/src/models/d.txt b/examples/models/d.txt similarity index 100% rename from src/models/d.txt rename to examples/models/d.txt diff --git a/src/models/pp.rb b/examples/models/pp.rb similarity index 100% rename from src/models/pp.rb rename to examples/models/pp.rb diff --git a/src/brain.c b/src/brain.c index 48d9639..e3d648b 100644 --- a/src/brain.c +++ b/src/brain.c @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "header.h" +#include "cbrain.h" /* Initialize new neuron */ struct neuron* neuron_init(uint id) diff --git a/src/header.h b/src/cbrain.h similarity index 100% rename from src/header.h rename to src/cbrain.h diff --git a/src/jar.c b/src/jar.c index 66856db..b2929b7 100644 --- a/src/jar.c +++ b/src/jar.c @@ -1,4 +1,4 @@ -#include "header.h" +#include "cbrain.h" struct jar* jar_init(int b_count) { diff --git a/src/thread.c b/src/thread.c index b707dd6..a5c3577 100644 --- a/src/thread.c +++ b/src/thread.c @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "header.h" +#include "cbrain.h" struct thread_args { uint s; diff --git a/src/util.c b/src/util.c index eb1e4e8..8831263 100644 --- a/src/util.c +++ b/src/util.c @@ -1,4 +1,4 @@ -#include "header.h" +#include "cbrain.h" #include int rand_int(int x, int y)