Commit f78470b3 authored by jkvis's avatar jkvis

New library build structure

parent 00e56266
Copyright (c) 2018 Jonathan K. Vis, Leids Universiteit Medisch Centrum
Copyright (c) 2018 Jonathan K. Vis, Leids Universitair Medisch Centrum
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......
CC = gcc
CFLAGS = -march=native
CPPFLAGS = -Iinclude/ -Ilib/sais-lite-lcp/ -Wall -Wextra -pedantic
DEBUG = -O0 -ggdb3
RELEASE = -O3 -DNDEBUG
SOURCES = $(shell find src/ -name '*.c')
INC_DIR = include
LIB_DIR = lib
SRC_DIR = src
LIBS = $(shell find $(LIB_DIR)/ -mindepth 1 -maxdepth 1 -type d)
LIB_INC = $(addsuffix /$(INC_DIR), $(LIBS))
SOURCES = $(shell find $(SRC_DIR)/ -name '*.c')
OBJECTS = $(SOURCES:.c=.o)
DEPS = $(OBJECTS:.o=.d)
LIBS = $(shell find lib/ -name '*.a')
TARGET = libgesa.a
.PHONY: all debug clean release tests
TARGET = libgesa.a
all: debug
CC = gcc
CFLAGS = -march=native
CPPFLAGS = $(addprefix -I, $(INC_DIR) $(LIB_INC)) -Wall -Wextra -pedantic
debug: CFLAGS += $(DEBUG)
debug: $(TARGET)
.PHONY: all clean debug libs release
release: CFLAGS += $(RELEASE)
release: $(TARGET)
release: CFLAGS += -O3 -fomit-frame-pointer -funroll-loops -DNDEBUG
release: all
$(TARGET): $(LIBS) $(OBJECTS)
$(MAKE) -wC lib/
ar rcsT $@ $(LIBS) $(OBJECTS)
debug: CFLAGS += -O0 -DDEBUG -ggdb3
debug: all
tests: $(TARGET)
$(MAKE) -wC tests/
all: $(TARGET) $(LIBS)
clean:
rm -f $(OBJECTS) $(DEPS) $(TARGET)
$(TARGET): $(OBJECTS)
ar rcs $@ $<
$(LIBS): libs
$(MAKE) -C $@ all CFLAGS="$(CFLAGS)"
-include $(DEPS)
%.o: %.c
......
......@@ -10,9 +10,11 @@ common prefix array (LCP) can be used.
GESAs are constructed from ESAs using a generalization of the merging
method from [2].
**NOTE** currently Algorithm 5.21 (from [2]) is implemented with a
worst-case O(n^2 ) complexity. We should implement Section 5.5.5.
**NOTE** currently Algorithm 5.21 [2] is implemented with a
worst-case O(n^2^) complexity. We should implement Section 5.5.5 [2],
which is based on [3].
## References
[1] J. Fischer. Inducing the LCP-Array. In F. Dehne, J. Iacono, and J. Sack, editors, *Algorithms and Data Structures: 12th International Symposium, WADS 2011, New York, USA, August 15-17, 2011. Proceedings*, pages 374-385. Springer, 2011.
[2] E. Ohlebusch. *Bioinformatics Algorithms: Sequence Analysis, Genome Rearrangements, and Phylogenetic Reconstruction* Oldenbusch Verlag, 2013.
[3] J.E. Jeon, H. Park and D.K. Kim. Efficient Construction of Generalized Suffix Arrays by Merging Suffix Arrays. *Journal of KIISE: Computer Systems and Theory*, 32(6):268-278, 2005.
CC = gcc
CFLAGS = -O3 -fomit-frame-pointer -funroll-loops -march=native
CPPFLAGS = -I. -DNDEBUG -Wall -Wextra -pedantic
TARGETS = sais-lite-lcp
SOURCES = sais-lite-lcp/sais.c
OBJECTS = $(SOURCES:.c=.o)
DEPS = $(OBJECTS:.o=.d)
.PHONY: clean
lib$(TARGETS:./%=%).a: $(OBJECTS)
ar rcsT $@ $<
clean:
rm -f $(OBJECTS) $(DEPS) lib$(TARGETS:./%=%).a
-include $(DEPS)
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -MMD -o $@ -c $<
Subproject commit a31f364be1103bd55918ea38855901064d077dd5
Subproject commit 0824607d24c8eed1d91421a85e8610215becd1d1
......@@ -2,7 +2,7 @@
#include <stdlib.h>
#include "../include/gesa.h"
#include "../lib/sais-lite-lcp/sais.h"
#include "../lib/sais-lite-lcp/include/sais.h"
int GESA_create(GESA* const gesa,
......
CXXC = g++
CXXFLAGS = -O0 -march=native
CPPFLAGS = -I../include/ -Wall -Wextra -pedantic
SOURCES = $(shell find . -name '*.cc')
OBJECTS = $(SOURCES:.cc=.o)
INC_LIB = $(shell find .. -name '*.a')
LIB_DIR = $(dir $(INC_LIB))
LIB_NAME = $(notdir $(INC_LIB))
INC_DIR = ../include
SOURCES = $(shell find . -name '*.c')
OBJECTS = $(SOURCES:.c=.o)
DEPS = $(OBJECTS:.o=.d)
TARGET = gesa_test
.PHONY: all clean memory_check
TARGET = tests
all: $(TARGET)
./$<
CC = gcc
CFLAGS = -march=native -O0 -DDEBUG -ggdb3
CPPFLAGS = $(addprefix -I, $(INC_DIR)) -Wall -Wextra -pedantic
memory_check: $(TARGET)
valgrind --leak-check=full ./$<
.PHONY: all clean
$(TARGET): $(OBJECTS)
$(CXXC) $(CXXFLAGS) $(CPPFLAGS) $(OBJECTS) -L.. -lgesa -o $@
all: $(TARGET)
clean:
rm -f $(OBJECTS) $(TARGET)
rm -f $(OBJECTS) $(DEPS) $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) $(CPPFLAGS) $^ $(addprefix -L, $(LIB_DIR)) $(addprefix -l, $(LIB_NAME:lib%.a=%) $(LIB_NAME:lib%.a=%)) -o $@
-include $(DEPS)
%.o: %.cc
$(CXXC) $(CXXFLAGS) $(CPPFLAGS) -MMD -o $@ -c $<
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -MMD -o $@ -c $<
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "../include/gesa.h"
int main(int, char* [])
int main(int argc, char* argv[])
{
(void) argc;
(void) argv;
static char const* const string = "test me";
GESA test;
......
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