-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (27 loc) · 860 Bytes
/
Makefile
File metadata and controls
35 lines (27 loc) · 860 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
# Generic Makefile for compiling a simple executable.
CC := g++
SRCDIR := src
BUILDDIR := build
CFLAGS := -g -Wall -std=c++0x -Weffc++ -Wextra -pedantic
LDFLAGS= -lstdc++ -lm -lpstatistics -lboost_program_options
TARGET := time_series
SRCEXT := cpp
BINDIR := /usr/bin
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
DIRS = $(shell find $(SRCDIR) -type d)
HEADERS := $(shell find $(SRCDIR) -type f -name *.h)
.PHONY: bin
bin:$(TARGET)
$(TARGET):$(OBJECTS)
$(CC) -o $(TARGET) $? $(LDFLAGS)
vpath %.$(SRCEXT) $(DIRS)
$(BUILDDIR)/%.o: %.$(SRCEXT)
@mkdir -p $(shell dirname $@)
$(CC) $(CFLAGS) $< -o $@ -c
.PHONY: clean
clean:
@echo " Cleaning..."; $(RM) -r $(BUILDDIR) $(TARGET)
.PHONY: install
install:
@echo " Installing..."; cp $(TARGET) /usr/bin