majic/Makefile
2020-06-03 16:19:25 +02:00

29 lines
741 B
Makefile

# Apprentice binary
ERL_EI_INCLUDE:=$(shell erl -eval 'io:format("~s", [code:lib_dir(erl_interface, include)])' -s init stop -noshell | head -1)
ERL_EI_LIB:=$(shell erl -eval 'io:format("~s", [code:lib_dir(erl_interface, lib)])' -s init stop -noshell | head -1)
CFLAGS = -std=c99 -g -Wall -Werror
CPPFLAGS = -I$(ERL_EI_INCLUDE)
LDFLAGS = -L$(ERL_EI_LIB)
LDLIBS = -lpthread -lei -lm -lmagic
BEAM_FILES = _build/
PRIV = priv/
RM = rm -Rf
# Unit test custom magic file
MAGIC = file
all: priv/apprentice test/elixir.mgc
test/%.mgc: test/%
cd test; file -C -m ../$^
priv/apprentice: src/apprentice.c
mkdir -p priv
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
clean:
$(RM) $(PRIV) $(BEAM_FILES) test/*.mgc
.PHONY: clean