2b87172744
This commit simplifies and fixes several quirks of the Makefile: * LDLIBS is now used instead of LDFLAGS * Only one step is now necessary to compile the binary * clean is now marked as a PHONY rule
29 lines
513 B
Makefile
29 lines
513 B
Makefile
# Apprentice binary
|
|
|
|
CC = gcc
|
|
CFLAGS = -std=c99 -g -Wall -Werror
|
|
LDLIBS = -lm -lmagic
|
|
BEAM_FILES = _build/
|
|
PRIV = priv/
|
|
RM = rm -Rf
|
|
|
|
# Unit test custom magic file
|
|
|
|
MAGIC = file
|
|
TEST_DIRECTORY = test
|
|
TARGET_MAGIC = $(TEST_DIRECTORY)/elixir.mgc
|
|
SOURCE_MAGIC = $(TEST_DIRECTORY)/elixir
|
|
|
|
priv/apprentice: src/apprentice.c
|
|
mkdir -p priv
|
|
$(CC) $(CFLAGS) $(LDLIBS) $^ -o $@
|
|
|
|
# Test case
|
|
|
|
$(TARGET_MAGIC): $(SOURCE_MAGIC)
|
|
cd $(TEST_DIRECTORY); $(MAGIC) -C -m elixir
|
|
|
|
clean:
|
|
$(RM) $(PRIV) $(BEAM_FILES)
|
|
|
|
.PHONY: clean
|