-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.in
62 lines (47 loc) · 1.52 KB
/
Makefile.in
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
BUILD_DIR ?= ./build
MKDIR_P ?= mkdir -p
VMAJOR := 0
VMINOR := 1
CXXFLAGS += -std=c++17 -pedantic -Wall -Wextra -O0 -g
INCLUDE += -I include
DEFINE +=
CPPFLAGS += $(DEFINE) $(INCLUDE) -MMD -MP
LIBOSSIM_SRC := $(shell find lib -name *.cpp)
LIBOSSIM_OBJ := $(LIBOSSIM_SRC:%=$(BUILD_DIR)/%.o)
LIBOSSIM_PIC_OBJ := $(LIBOSSIM_SRC:%=$(BUILD_DIR)/%.pic.o)
LIBOSSIM_DEP := $(LIBOSSIM_OBJ:.o=.d) $(LIBOSSIM_PIC_OBJ:.o=.d)
all: libossim.a libossim.so
libossim.a: $(LIBOSSIM_OBJ)
ar rcs $@ $(LIBOSSIM_OBJ)
libossim.so: $(LIBOSSIM_PIC_OBJ)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -fPIC $(LIBOSSIM_PIC_OBJ) -o $@
$(BUILD_DIR)/%.cpp.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
$(BUILD_DIR)/%.cpp.pic.o: %.cpp
$(MKDIR_P) $(dir $@)
$(CXX) $(CPPFLAGS) -fPIC $(CXXFLAGS) -c $< -o $@
install: libossim.so
$(MKDIR_P) $(PREFIX)/lib
$(MKDIR_P) $(PREFIX)/include
cp $< $(PREFIX)/lib/$<.$(VMAJOR).$(VMINOR)
ln -s $(PREFIX)/lib/$<.$(VMAJOR).$(VMINOR) $(PREFIX)/lib/$<.$(VMAJOR)
ln -s $(PREFIX)/lib/$<.$(VMAJOR) $(PREFIX)/lib/$<
ldconfig
cp -r include/ossim $(PREFIX)/include/
uninstall:
$(RM) $(PREFIX)/lib/libossim.so
$(RM) $(PREFIX)/lib/libossim.so.$(VMAJOR)
$(RM) $(PREFIX)/lib/libossim.so.$(VMAJOR).$(VMINOR)
ldconfig
$(RM) -r $(PREFIX)/include/ossim
clean:
$(RM) -r $(BUILD_DIR)
$(RM) libossim.a
$(RM) libossim.so
tidy:
clang-tidy $(LIBOSSIM_SRC) -- $(INCLUDE) $(DEFINE) $(CXXFLAGS)
format:
find -name '*.cpp' -o -name '*.hpp' | xargs clang-format -i
-include $(LIBOSSIM_DEP)
.PHONY: all install clean tidy format