-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (32 loc) · 845 Bytes
/
Makefile
File metadata and controls
42 lines (32 loc) · 845 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
35
36
37
38
39
40
41
42
# Project directories
SRCDIR := src
INCDIR := include
BINDIR := bin
OBJDIR := obj
LIBDIR := lib
# Targets with main code inside
TARGETS := bin/mvas
# Required flags
CC := gcc
CCFLAGS := -Wall -lpthread -std=gnu11
INCLUDES := -I./$(INCDIR)/
#DEBUG := -D_DEBUG_
DEBUG :=
# Required libs
#LIBMVAS := $(LIBDIR)/libmvas
LIBMVAS := -lmvas
# Files to process
SRCFILES := $(shell find -name '*.c' -printf '%P ')
OBJFILES := $(basename $(subst $(SRCDIR),$(OBJDIR),$(SRCFILES)))
all: prepare $(TARGETS)
$(TARGETS): $(OBJFILES:%=%.o)
$(CC) $(CCFLAGS) $^ $(LIBMVAS) -o $@ $(DEBUG) $(INCLUDES)
$(OBJDIR)/%.o: $(basename $(subst $(OBJDIR),$(SRCDIR),$(OBJDIR)/%.o)).c
$(CC) -o $@ -c $< $(INCLUDES) $(CCFLAGS) $(DEBUG) $(LIBMVAS)
.PHONY: clean, prepare
prepare:
mkdir -p $(BINDIR)
mkdir -p $(OBJDIR)
clean:
rm -rf $(BINDIR)/*
rm -rf $(OBJDIR)/*