-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (39 loc) · 1.07 KB
/
Copy pathMakefile
File metadata and controls
50 lines (39 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
CC=gcc
LD=gcc
CFLAGS=-Isrc -Wall -O3 -march=native -funroll-loops -ffast-math -flto=thin
LDFLAGS=-Wall -lz -framework Accelerate -lgsl -O3 -flto=thin
SRCDIR:=src
BUILDDIR:=build
BINDIR:=bin
SRCEXT:=c
MKDIR:=@mkdir -p
SOURCES:=$(shell find $(SRCDIR) -type f -name "*.$(SRCEXT)")
OBJS:=$(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
DIRS:= automaton utils nn search
SOURCEDIRS:=$(foreach dir,$(DIRS),$(addprefix $(SRCEDIR)/, $(dir)))
TARGETDIRS:=$(foreach dir,$(DIRS),$(addprefix $(BUILDDIR)/, $(dir)))
TARGET:=$(BINDIR)/automaton
all: directories $(TARGET)
$(MAKE) tools/viz/step_to_ppm
$(TARGET): $(OBJS)
$(MKDIR) $(BINDIR)
$(LD) $(LDFLAGS) $+ -o $@
.PHONY: directories
directories:
$(MKDIR) $(TARGETDIRS)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
$(MKDIR) $(BUILDDIR)
$(CC) $(CFLAGS) $(XCFLAGS) $+ -c -o $@
.PHONY: clean
clean:
rm -rf $(OBJS)
rm -rf $(TARGET)
rmdir $(TARGETDIRS)
rmdir $(BINDIR)
rmdir $(BUILDDIR)
tools/viz/step_to_ppm:
gcc ./tools/viz/step_to_ppm.c -o ./tools/viz/step_to_ppm -lnetpbm
.PHONY: rebuild
rebuild:
$(MAKE) clean
$(MAKE) all