Commit e6a0de94 authored by jkvis's avatar jkvis

New library build structure

parent a31f364b
# Makefile for suftest and test
# options
CC = gcc
#CXX = g++
#OUTPUT_OPTION = -o $@
CFLAGS = -ffast-math -O9 -funroll-loops -DNDEBUG
#CFLAGS = -O3 -fomit-frame-pointer -funroll-loops
#CXXFLAGS = -O3 -fomit-frame-pointer
CPPFLAGS = -Wall -DNDEBUG
#CPPFLAGS = -Wall
LDFLAGS =
LDLIBS =
#TARGET_ARCH =
# targets
.PHONY: all
all: suftest
suftest: sais.o suftest.o
test:
$(CC) -O -g -Wall test.c sais.c -o test
./test
$(RM) test test.exe
distclean: clean
INC_DIR = include
SRC_DIR = src
SOURCES = $(shell find $(SRC_DIR)/ -name '*.c')
OBJECTS = $(SOURCES:.c=.o)
DEPS = $(OBJECTS:.o=.d)
TARGET = libsais-lite-lcp.a
CC = gcc
CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -march=native -DNDEBUG
CPPFLAGS = $(addprefix -I, $(INC_DIR)) -Wall -Wextra -pedantic
.PHONY: all clean
all: $(TARGET)
clean:
$(RM) suftest suftest.exe test test.exe sais.o suftest.o
rm -f $(OBJECTS) $(DEPS) $(TARGET)
$(TARGET): $(OBJECTS)
ar rcs $@ $<
-include $(DEPS)
# dependencies
sais.o suftest.o: sais.h Makefile
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -MMD -o $@ -c $<
......@@ -4,17 +4,21 @@ This is an ad-hoc-implementation of the code described in ["Inducing the LCP-Arr
Nong, G., Zhang, S., & Chan, W. H. (2011). Two efficient algorithms for linear time suffix array construction. Computers, *IEEE Transactions on, 60(10)*, 1471-1484.
The original version of the code can be found [here](http://algo2.iti.kit.edu/english/1828.php).
## Building and Running
To build use the makefile and to test the code use the suftest as described below.
## Building
To build use the makefile to build the static library `libsais-lite-lcp.a`:
```
$ make
```
Please notice that the *input string* is required to be ended by a special sentinel value (`'\0'`). Thus the last character of the text is automatically considered to be an unique character which is also the lexicographically smallest character.
make
./suftest <textfile>
Please notice that the *textfile* is required to be ended by a special sentinel value. Thus the last character of the text is automatically considered to be an unique character which is also the lexicographically smallest character.
#Contributors
## Contributors
+ [Johannes Fischer](http://ls11-www.cs.tu-dortmund.de/staff/fischer) (Author)
+ [Florian Kurpicz](http://ls11-www.cs.tu-dortmund.de/staff/kurpicz)
+ Jonathan K. Vis
# Changelog
## Changelog
### Version 0.0.1
+ Initial Release
### Version 0.1.0
+ Library build
+ Reverted to immutable input strings
......@@ -33,7 +33,7 @@ extern "C" {
/* find the suffix array SA of T[0..n-1]
use a working space (excluding T and SA) of at most 2n+O(lg n) */
int sais(unsigned char *T, int *SA, int *LCP, int n);
int sais(unsigned char const *T, int *SA, int *LCP, int n);
/* find the suffix array SA of T[0..n-1] in {0..k-1}^n
use a working space (excluding T and SA) of at most MAX(4k,2n) */
......
This diff is collapsed.
......@@ -826,7 +826,7 @@ static sais_index_type sais_main(const void *T, sais_index_type *SA,
/*---------------------------------------------------------------------------*/
int
sais(unsigned char *T, int *SA, int* LCP, int n) {
sais(unsigned char const *T, int *SA, int* LCP, int n) {
if((T == NULL) || (SA == NULL) || (LCP == NULL) || (n < 0)) { return -1; }
if(n <= 1) { if(n == 1) { SA[0] = 0; LCP[0] = 0; } return 0; }
return sais_main(T, SA, LCP, 0, n, UCHAR_SIZE, sizeof(unsigned char), 0,1);
......
......@@ -28,7 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "sais.h"
#include "../include/sais.h"
/* Checks the suffix array SA of the string T. */
......
......@@ -27,7 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sais.h"
#include "../include/sais.h"
static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment