forked from AllwineDesigns/stl_cmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (45 loc) · 1.7 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
prefix?=/usr/local
target=$(DESTDIR)$(prefix)
VERSION=1.1
DOCS_DIR := man
BIN_DIR := bin
CMDS := $(addprefix $(BIN_DIR)/,stl_header stl_merge stl_transform stl_count stl_bbox stl_cube stl_sphere stl_cylinder stl_cylinders stl_cone stl_torus stl_empty stl_threads stl_normals stl_convex stl_borders stl_spreadsheet stl_area stl_bcylinder)
CSGJS_CMDS := $(addprefix $(BIN_DIR)/,stl_boolean stl_flat stl_decimate)
ALL_CMDS := $(CSGJS_CMDS) $(CMDS)
CC := g++
#FLAGS=-Og -g -std=c++11
FLAGS=-O3 -std=c++11
all: $(CMDS) $(CSGJS_CMDS)
$(CMDS): $(BIN_DIR)/%: src/%.cpp src/stl_util.h
$(CC) $(FLAGS) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OUTPUT_OPTION) $<
$(CSGJS_CMDS): $(BIN_DIR)/%: src/%.cpp src/csgjs/*.cpp src/csgjs/math/*.cpp src/csgjs/math/*.h src/csgjs/*.h src/Simplify.h
$(CC) $(FLAGS) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LDFLAGS) src/csgjs/*.cpp src/csgjs/math/*.cpp -Isrc $(OUTPUT_OPTION) $<
$(CMDS): | $(BIN_DIR)
$(BIN_DIR):
mkdir $(BIN_DIR)
clean:
rm -rf $(BIN_DIR)
$(DOCS_DIR):
mkdir $(DOCS_DIR)
docs: $(DOCS_DIR) $(CMDS)
for cmd in $(ALL_CMDS); do \
help2man $$cmd --name="$$($$cmd --help 2>&1 | head --lines=1)" --no-discard-stderr --version-string="v$(VERSION)" --no-info > $(DOCS_DIR)/$$(basename $$cmd).1; \
done
installDocs: docs
install -d $(target)/share/man/man1
for cmd in $(ALL_CMDS); do \
gzip -c -9 $(DOCS_DIR)/$$(basename $$cmd).1 > $(target)/share/man/man1/$$(basename $$cmd).1.gz; \
done
uninstallDocs:
for cmd in $(ALL_CMDS); do \
rm $(target)/share/man/man1/$$(basename $$cmd).1.gz; \
done
install: all
install -d $(target)/bin
for cmd in $(ALL_CMDS); do \
install $$cmd $(target)/$$cmd; \
done
uninstall:
for cmd in $(ALL_CMDS); do \
rm $(target)/$$cmd; \
done