forked from Ultimaker/CuraEngine
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
89 lines (71 loc) · 2.32 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#
# Makefile for CuraEngine
#
BUILD_DIR = build
SRC_DIR = src
LIBS_DIR = libs
BUILD_TYPE = RELEASE
VERSION ?= DEV
CXX ?= g++
CFLAGS += -c -Wall -Wextra -Wold-style-cast -Woverloaded-virtual -std=c++11 -DVERSION=\"$(VERSION)\" -isystem libs
ifeq ($(BUILD_TYPE),DEBUG)
CFLAGS+=-ggdb -Og -g
endif
ifeq ($(BUILD_TYPE),PROFILE)
CFLAGS+= -pg
endif
ifeq ($(BUILD_TYPE),RELEASE)
CFLAGS+= -O3 -fomit-frame-pointer
endif
LDFLAGS += -Lbuild/ -lclipper
SOURCES_RAW = bridge.cpp comb.cpp gcodeExport.cpp infill.cpp inset.cpp layerPart.cpp main.cpp optimizedModel.cpp pathOrderOptimizer.cpp polygonOptimizer.cpp raft.cpp settings.cpp skin.cpp skirt.cpp slicer.cpp support.cpp timeEstimate.cpp
SOURCES_RAW += modelFile/modelFile.cpp utils/gettime.cpp utils/logoutput.cpp utils/socket.cpp
SOURCES = $(addprefix $(SRC_DIR)/,$(SOURCES_RAW))
OBJECTS_RAW = $(SOURCES_RAW:.cpp=.o)
OBJECTS = $(addprefix $(BUILD_DIR)/,$(OBJECTS_RAW))
DIRS = $(sort $(dir $(OBJECTS)))
EXECUTABLE = $(BUILD_DIR)/CuraEngine
ifeq ($(OS),Windows_NT)
#For windows make it large address aware, which allows the process to use more then 2GB of memory.
EXECUTABLE := $(EXECUTABLE).exe
CFLAGS += -march=pentium4 -flto
LDFLAGS += -Wl,--large-address-aware -lm -lwsock32 -flto
MKDIR_PREFIX = mkdir -p
else
MKDIR_PREFIX = mkdir -p
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
OPEN_HTML=firefox
ifeq ($(BUILD_TYPE),DEBUG)
LDFLAGS += --static
else
CFLAGS += -flto
LDFLAGS += --static -flto
endif
endif
ifeq ($(UNAME), OpenBSD)
LDFLAGS += -lm -lpthread
endif
ifeq ($(UNAME), Darwin)
OPEN_HTML=open
#For MacOS force to build
CFLAGS += -force_cpusubtype_ALL -mmacosx-version-min=10.6 -arch x86_64 -arch i386
LDFLAGS += -force_cpusubtype_ALL -mmacosx-version-min=10.6 -arch x86_64 -arch i386
endif
endif
all: $(DIRS) $(SOURCES) $(EXECUTABLE)
$(BUILD_DIR)/libclipper.a: $(LIBS_DIR)/clipper/clipper.cpp
$(CXX) $(CFLAGS) -o $(BUILD_DIR)/libclipper.a $(LIBS_DIR)/clipper/clipper.cpp
$(EXECUTABLE): $(OBJECTS) $(BUILD_DIR)/libclipper.a
$(CXX) $(OBJECTS) -o $@ $(LDFLAGS)
$(DIRS):
-@$(MKDIR_PREFIX) $(DIRS)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CFLAGS) $< -o $@
test: $(EXECUTABLE)
python tests/runtest.py $(abspath $(EXECUTABLE))
## clean stuff
clean:
rm -f $(EXECUTABLE) $(OBJECTS) $(BUILD_DIR)/libclipper.a
help:
@cat Makefile |grep \#\#| grep \: |cut -d\# -f3