GNU Makefile for google benchmark I've decided to write a common Makefile for Google benchmark library. You could say I could have taken generated Makefile, but it's not appropriate solution (or maybe I'm wrong?).

TARGET = libbenchmark.a

CXXFLAGS = -std=c++11 -Wall -Wextra -Wshadow -Werror -pedantic \
            -pedantic-errors -Wfloat-equal \
            -Wzero-as-null-pointer-constant -fstrict-aliasing \
            -DHAVE_STD_REGEX

LDFLAGS = -lpthread

# Define include files and directories
INCLUDES = -I./include -I./src

# Define the source files
SOURCE_FILES = src/colorprint.cc src/benchmark.cc src/commandlineflags.cc \
               src/console_reporter.cc src/csv_reporter.cc src/json_reporter.cc \
               src/log.cc src/reporter.cc src/sleep.cc src/string_util.cc \
               src/sysinfo.cc src/walltime.cc src/re_std.cc

OBJECT_FILES = $(SOURCE_FILES:.cc=.o)

CC = gcc
AR = gcc-ar

all: $(TARGET)

$(TARGET): $(OBJECT_FILES)
    $(AR) rcs $(TARGET) $(OBJECT_FILES)

%.o: %.cc 
    $(CC) $(INCLUDES) $(CXXFLAGS) -c -o $@ $&lt;

clean:
    $(RM) src/*.o $(TARGET)

install:
    mkdir -p $(DESTDIR)/usr/lib
    cp -p ./$(TARGET) $(DESTDIR)/usr/lib
    cp -r include $(DESTDIR)/usr
In a clean rule, consider removing $(OBJECT_FILES) instead of src/*.o
I don't see where LDFLAGS is ever used.
I understand that you are not likely to edit include files; however, to be on a safe side you may want to add auto dependency generation:

DEP_FILES = $(SOURCE_FILES:.cc=.d)

%.d: %.cc
    $(CC) $(INCLUDES) $(CXXFLAGS) -MM -MT -o $@ $&lt;

-include $(DEP_FILES)


(and remove $(DEP_FILES) on clean).