added make install and uninstall targets

C linkage for state and generator mutation
lib
Avril 3 years ago
parent bc7186028e
commit 11cc8d666d
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,5 +1,10 @@
PROJECT=sm
AUTHOR=Avril (Flanchan) <flanchan@cumallover.me>
VERSION=1.0.0
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
SRC_C = $(wildcard src/*.c)
SRC_CXX = $(wildcard src/*.cpp)
@ -9,7 +14,9 @@ TEST_SRC_CXX = $(wildcard src/test/*.cpp)
INCLUDE=include
COMMON_FLAGS= -W -Wall -pedantic -fno-strict-aliasing $(addprefix -I,$(INCLUDE))
HEADERS=$(INCLUDE)/*.h
COMMON_FLAGS= -D_VERSION=$(VERSION) -W -Wall -pedantic -fno-strict-aliasing $(addprefix -I,$(INCLUDE))
OPT_FLAGS?= -march=native -fgraphite -fopenmp -floop-parallelize-all -ftree-parallelize-loops=4 \
-floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block \
@ -52,6 +59,9 @@ debug: | dirs lib$(PROJECT)-debug.so lib$(PROJECT)-debug.a
.PHONY: test
test: | dirs $(PROJECT)-test
.PHONY: install
.PHONY: uninstall
# Targets
dirs:
@ -102,3 +112,15 @@ clean-rebuild:
clean: clean-rebuild
rm -f lib$(PROJECT){-debug,}.{so,a}
rm -f $(PROJECT)-test
install: | dirs lib$(PROJECT).a lib$(PROJECT).so
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 lib$(PROJECT).a $(DESTDIR)$(PREFIX)/lib/
install -m 755 lib$(PROJECT).so $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/$(PROJECT)/
install -m 644 $(HEADERS) $(DESTDIR)$(PREFIX)/include/$(PROJECT)/
uninstall:
rm $(DESTDIR)$(PREFIX)/lib/lib$(PROJECT).{a,so}
ls $(HEADERS) | xargs -I {} basename {} | xargs -I {} rm "$(DESTDIR)$(PREFIX)/include/$(PROJECT)/{}"
rmdir $(DESTDIR)$(PREFIX)/include/$(PROJECT)

@ -112,5 +112,7 @@ inline sm_yield sm_continue() { return (sm_yield)_sm_noop; }
// ---
sm_state* sm_new_state();
void sm_free_state(sm_state* state);
extern "C" {
sm_state* sm_new_state();
void sm_free_state(sm_state* state);
}

@ -3,11 +3,15 @@
#ifdef __cplusplus
#define EX_C extern "C"
#include <cstdio>
#define restrict __restrict__
[[noreturn]]
#else
#define EX_C
#include <stdio.h>
__attribute__((noreturn))

@ -1,6 +1,5 @@
#include <gen.h>
#define EX_C extern "C"
#include "dev.h"
struct sm_generator
{

@ -13,7 +13,7 @@ sm_yield _sm_noop(sm_state*)
return (sm_yield)nullptr;
}
sm_state* sm_new_state()
EX_C sm_state* sm_new_state()
{
auto state = box<sm_state>();
state->current = box<_sm_frame, true>();
@ -54,7 +54,7 @@ inline static void _sm_free_all_pages(_sm_user_page* page)
}
}
void sm_free_state(sm_state* state)
EX_C void sm_free_state(sm_state* state)
{
_sm_frame* frame = unbox(state).current;

Loading…
Cancel
Save