-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
34 lines (27 loc) · 731 Bytes
/
Copy pathmakefile
File metadata and controls
34 lines (27 loc) · 731 Bytes
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
IDIR =include
SRCDIR=src
ODIR=$(SRCDIR)/obj
BINDIR=bin
UTILDIR=utils
BINARYNAME=mandelbrot
CC=gcc
CFLAGS=-I$(IDIR)
LIBS=-lgmp -lmpfr
DEPS := $(shell find $(IDIR) -name '*.h')
SOURCES := $(shell find $(SRCDIR) -name '*.c')
OBJECTS := $(patsubst $(SRCDIR)/%,$(ODIR)/%,$(SOURCES:%.c=%.o))
_UTILS := $(shell find $(UTILDIR) -name '*.c')
UTILS := $(_UTILS:$(UTILDIR)/%.c=$(BINDIR)/%)
all: $(BINDIR)/$(BINARYNAME) $(UTILS)
$(BINDIR)/$(BINARYNAME): $(OBJECTS)
mkdir -p bin
$(CC) -o $@ $^ $(LIBS)
$(BINDIR)/%: $(UTILDIR)/%.c $(DEPS)
mkdir -p bin
$(CC) -o $@ $< $(CFLAGS) $(LIBS)
$(ODIR)/%.o: $(SRCDIR)/%.c $(DEPS)
mkdir -p src/obj
$(CC) -c -o $@ $< $(CFLAGS) $(LIBS)
.PHONY: clean
clean:
rm -f $(ODIR)/*.o *~ core $(IDIR)/*~