From: Benjamin Auder Date: Mon, 29 Jan 2018 19:56:28 +0000 (+0100) Subject: Simplify installation procedure X-Git-Url: https://git.auder.net/doc/current/%7B%7B%20asset%28%27mixstore/css/static/%7B%7B?a=commitdiff_plain;h=aef8a9962382222aa64fd5c2f91be9dab1d298e2;p=cgds.git Simplify installation procedure --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9d261d --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.o +/src/obj/*.so +/test/test +/doc/html/ +/doc/latex/ diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index e43cd6f..0000000 --- a/AUTHORS +++ /dev/null @@ -1,13 +0,0 @@ -#Document updated on 2014-12-09. -################################ - -#Active developers. - -Years | Name | Contact email ----------|--------------------|-------------------------- -2013-now | Benjamin Auder | benjamin.a@mailoo.org - -#Past code contributors. - -Years | Name -----------|-------------------- diff --git a/INSTALL b/INSTALL deleted file mode 100644 index fc04dbc..0000000 --- a/INSTALL +++ /dev/null @@ -1,9 +0,0 @@ -To build on (hopefully) any GNU/Linux [brackets means "optional"] : - - make [src] - [make test] - make install - -To (un)install the library : - - make (un)install diff --git a/LICENSE b/LICENSE index 4422e1d..7fdc5ec 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,15 @@ -Expat License (often called "MIT license") +ISC license https://opensource.org/licenses/ISC -Copyright (c) 2013-2014 Benjamin Auder +Copyright (C) 2013-2018 Benjamin Auder -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/Makefile b/Makefile index 86f819b..de9dd81 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,13 @@ LIBRARY = libcgds.so INSTALL_PREFIX = /usr/local +all: src + src: cd src && $(MAKE) && cd .. test: - cd test && $(MAKE) && cd .. + cd test && ./makeMain.sh && $(MAKE) && cd .. doc: cd doc && $(MAKE) && cd .. diff --git a/README.md b/README.md index c67b79f..342d2d6 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ Various data structures, from stack to tree, which can contain any data type. +## Installation + + make [src] + make install +'src' is Makefile default target. + ## Example Vector* v = vector_new(int); diff --git a/cgds b/cgds index e831038..aa8e45f 120000 --- a/cgds +++ b/cgds @@ -1 +1 @@ -src \ No newline at end of file +src/ \ No newline at end of file diff --git a/makeMakefile.sh b/makeMakefile.sh deleted file mode 100755 index 7419805..0000000 --- a/makeMakefile.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/bash - -subfolder=$1 - -cd $subfolder -cat Makefile.base > Makefile -printf "\n" >> Makefile -for folder in `find . -path ./obj -prune -o -type d -print`; do - mkdir -p obj/$folder -done - -sources=`find . -type f -name \*.c` -objects="" -for file in $sources; do - objects+="obj/${file%?}o " -done -printf "obj/\$(TARGET): $objects\n" >> Makefile -printf '\t$(CC) $(LDFLAGS) -o $@ $^\n\n' >> Makefile - -for file in $sources; do - deps=`grep '#include "' $file | cut -d ' ' -f 2 | sed 's/^"\(.*\)"$/..\/\1/g' | tr '\n' ' '` - fileDotO="obj/${file%?}o" - printf "$fileDotO: $file $deps\n" >> Makefile - printf '\t$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<\n\n' >> Makefile -done - -cd .. diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 5d3fa11..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -obj/ -Makefile diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..d995fd6 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,26 @@ +CC = gcc +CFLAGS = -g -std=gnu99 -fPIC +LDFLAGS = -shared +INCLUDES = -I.. + +SRC_DIR = ./ +OBJ_DIR = ./obj + +TARGET = $(OBJ_DIR)/libcgds.so + +SRC_FILES = $(wildcard $(SRC_DIR)/*.c) +H_FILES = $(wildcard $(SRC_DIR)/*.h) +OBJ_FILES = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC_FILES)) + +all: $(TARGET) + +$(TARGET): $(OBJ_FILES) + $(CC) $(LDFLAGS) -o $@ $^ + +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(SRC_DIR)/%.h + $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< + +clean: + rm -f $(OBJ_DIR)/*.o $(TARGET) + +.PHONY: all clean diff --git a/src/Makefile.base b/src/Makefile.base deleted file mode 100644 index 2df7d91..0000000 --- a/src/Makefile.base +++ /dev/null @@ -1,13 +0,0 @@ -CC = gcc -CFLAGS = -g -std=gnu99 -fPIC -LDFLAGS = -shared -INCLUDES = -I.. -TARGET = libcgds.so - -all: obj/$(TARGET) - -clean: - rm -f obj/*.o - rm -f obj/$(TARGET) - -.PHONY: all clean diff --git a/src/obj/.gitkeep b/src/obj/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index 5d3fa11..0000000 --- a/test/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -obj/ -Makefile diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..c3a67ab --- /dev/null +++ b/test/Makefile @@ -0,0 +1,26 @@ +CC = gcc +CFLAGS = -g -std=gnu99 -Wno-implicit-function-declaration +LDFLAGS = -L../src/obj -lcgds -Wl,-rpath=../src/obj +INCLUDES = -I.. + +SRC_DIR = ./ +OBJ_DIR = ./obj + +TARGET = test + +SRC_FILES = $(wildcard $(SRC_DIR)/*.c) +H_FILES = lut.h helpers.h +OBJ_FILES = $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC_FILES)) + +all: $(TARGET) + +$(TARGET): $(OBJ_FILES) + $(CC) $(LDFLAGS) -o $@ $^ + +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(H_FILES) + $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< + +clean: + rm -f $(OBJ_DIR)/*.o $(TARGET) + +.PHONY: all clean diff --git a/test/Makefile.base b/test/Makefile.base deleted file mode 100644 index 549baf8..0000000 --- a/test/Makefile.base +++ /dev/null @@ -1,13 +0,0 @@ -CC = gcc -CFLAGS = -g -std=gnu99 -Wno-implicit-function-declaration -LDFLAGS = -L../src/obj -lcgds -INCLUDES = -I.. -I../src -TARGET = testcgds - -all: obj/$(TARGET) - -clean: - rm -f obj/*.o - rm -f obj/$(TARGET) - -.PHONY: all clean diff --git a/test/README b/test/README new file mode 100644 index 0000000..6ea0137 --- /dev/null +++ b/test/README @@ -0,0 +1,4 @@ +Testing procedure (assuming src/Makefile already run): + 1) ./makeMain.sh + 2) make + 3) ./test diff --git a/test/main.c b/test/main.c index 7b8f5ff..3c2cf04 100644 --- a/test/main.c +++ b/test/main.c @@ -2,19 +2,19 @@ int main(int argc, char** argv) { - //file ./t.Vector.c : - t_vector_clear(); - t_vector_size(); - t_vector_push_pop_basic(); - t_vector_push_pop_evolved(); - t_vector_copy(); + //file ./t.Stack.c : + t_stack_clear(); + t_stack_size(); + t_stack_push_pop_basic(); + t_stack_push_pop_evolved(); + t_stack_copy(); - //file ./t.BufferTop.c : - t_buffertop_clear(); - t_buffertop_size(); - t_buffertop_push_pop_basic(); - t_buffertop_push_pop_evolved(); - t_buffertop_copy(); + //file ./t.List.c : + t_list_clear(); + t_list_size(); + t_list_push_pop_basic(); + t_list_push_pop_evolved(); + t_list_copy(); //file ./t.Tree.c : t_tree_clear(); @@ -23,19 +23,12 @@ int main(int argc, char** argv) t_tree_iterate(); t_tree_copy(); - //file ./t.Heap.c : - t_heap_clear(); - t_heap_size(); - t_heap_push_pop_basic(); - t_heap_push_pop_evolved(); - t_heap_copy(); - - //file ./t.List.c : - t_list_clear(); - t_list_size(); - t_list_push_pop_basic(); - t_list_push_pop_evolved(); - t_list_copy(); + //file ./t.Vector.c : + t_vector_clear(); + t_vector_size(); + t_vector_push_pop_basic(); + t_vector_push_pop_evolved(); + t_vector_copy(); //file ./t.Queue.c : t_queue_clear(); @@ -44,12 +37,19 @@ int main(int argc, char** argv) t_queue_push_pop_evolved(); t_queue_copy(); - //file ./t.Stack.c : - t_stack_clear(); - t_stack_size(); - t_stack_push_pop_basic(); - t_stack_push_pop_evolved(); - t_stack_copy(); + //file ./t.Heap.c : + t_heap_clear(); + t_heap_size(); + t_heap_push_pop_basic(); + t_heap_push_pop_evolved(); + t_heap_copy(); + + //file ./t.BufferTop.c : + t_buffertop_clear(); + t_buffertop_size(); + t_buffertop_push_pop_basic(); + t_buffertop_push_pop_evolved(); + t_buffertop_copy(); //file ./t.PriorityQueue.c : t_priorityqueue_clear(); diff --git a/test/makeMain.sh b/test/makeMain.sh old mode 100644 new mode 100755 diff --git a/test/obj/.gitkeep b/test/obj/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/t.BufferTop.c b/test/t.BufferTop.c index 17492c6..42b31c9 100644 --- a/test/t.BufferTop.c +++ b/test/t.BufferTop.c @@ -1,7 +1,7 @@ #include #include "cgds/BufferTop.h" -#include "test/helpers.h" -#include "test/lut.h" +#include "helpers.h" +#include "lut.h" void t_buffertop_clear() { diff --git a/test/t.Heap.c b/test/t.Heap.c index e3d6bbc..b01f835 100644 --- a/test/t.Heap.c +++ b/test/t.Heap.c @@ -1,7 +1,7 @@ #include #include "cgds/Heap.h" -#include "test/helpers.h" -#include "test/lut.h" +#include "helpers.h" +#include "lut.h" void t_heap_clear() { diff --git a/test/t.List.c b/test/t.List.c index 51a83b3..83db68f 100644 --- a/test/t.List.c +++ b/test/t.List.c @@ -1,7 +1,7 @@ #include #include "cgds/List.h" -#include "test/helpers.h" -#include "test/lut.h" +#include "helpers.h" +#include "lut.h" void t_list_clear() { diff --git a/test/t.PriorityQueue.c b/test/t.PriorityQueue.c index 66417e5..e5c3bae 100644 --- a/test/t.PriorityQueue.c +++ b/test/t.PriorityQueue.c @@ -1,7 +1,7 @@ #include #include "cgds/PriorityQueue.h" -#include "test/helpers.h" -#include "test/lut.h" +#include "helpers.h" +#include "lut.h" void t_priorityqueue_clear() { diff --git a/test/t.Queue.c b/test/t.Queue.c index bf095c7..a393da2 100644 --- a/test/t.Queue.c +++ b/test/t.Queue.c @@ -1,7 +1,7 @@ #include #include "cgds/Queue.h" -#include "test/helpers.h" -#include "test/lut.h" +#include "helpers.h" +#include "lut.h" void t_queue_clear() { diff --git a/test/t.Stack.c b/test/t.Stack.c index 5b99b4f..ba53e9f 100644 --- a/test/t.Stack.c +++ b/test/t.Stack.c @@ -1,7 +1,7 @@ #include #include "cgds/Stack.h" -#include "test/helpers.h" -#include "test/lut.h" +#include "helpers.h" +#include "lut.h" void t_stack_clear() { diff --git a/test/t.Tree.c b/test/t.Tree.c index 131ba15..3bbf00a 100644 --- a/test/t.Tree.c +++ b/test/t.Tree.c @@ -1,7 +1,7 @@ #include #include "cgds/Tree.h" -#include "test/helpers.h" -#include "test/lut.h" +#include "helpers.h" +#include "lut.h" void t_tree_clear() { diff --git a/test/t.Vector.c b/test/t.Vector.c index 8eb32bd..6cae626 100644 --- a/test/t.Vector.c +++ b/test/t.Vector.c @@ -1,7 +1,7 @@ #include #include "cgds/Vector.h" -#include "test/helpers.h" -#include "test/lut.h" +#include "helpers.h" +#include "lut.h" void t_vector_clear() {