-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
45 lines (33 loc) · 1.05 KB
/
Makefile
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
#
# This Makefile is for development use only, it needs to be updated or generated
# from autoconf for cross-platform deployment
#
CXX := g++
SRCEXT := cpp
SRCDIR := src
TESTDIR := test
BUILDDIR := build
LIBDIR := lib
BINDIR := bin
TARGET := $(LIBDIR)/libembed.so
TARGET_INCLUDE := -I include
TARGET_CPPFLAGS := $(TARGET_INCLUDE)
TARGET_CXXFLAGS := -Wall -fPIC
TARGET_LDLIBS :=
TARGET_LDFLAGS := -L$(LIBDIR) -shared
TARGET_SOURCES := $(notdir $(shell find $(SRCDIR) -type f -name *.$(SRCEXT)))
TARGET_OBJECTS := $(addprefix $(BUILDDIR)/, $(TARGET_SOURCES:.$(SRCEXT)=.o))
VPATH = $(shell find $(SRCDIR)/* -type d) $(shell find $(TESTDIR)/* -type d)
all: embed
embed: $(TARGET)
$(TARGET): $(TARGET_OBJECTS)
$(CXX) $(TARGET_LDFLAGS) -o $@ $(TARGET_OBJECTS) $(TARGET_LOADLIBS)
clean:
rm -rf $(BUILDDIR)/* $(LIBDIR)/* $(BINDIR)/*
.PHONY: clean
include $(TESTDIR)/Makefile.in
tests: $(TESTS)
$(BUILDDIR)/%.o: %.$(SRCEXT)
$(if $(findstring src/,$^), \
$(CXX) $^ -c -o $@ $(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS), \
$(CXX) $^ -c -o $@ $(TEST_CPPFLAGS) $(TEST_CXXFLAGS))