forked from payonel/ocvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (60 loc) · 2.26 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
ifeq ($(lua),)
lua=5.2
endif
TARGET_EXEC ?= ocvm
INC_DIRS ?= ./
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
ifneq ($(luapath),)
LDFLAGS?=${luapath}/liblua.a
INC_FLAGS+=-I${luapath}
else
LDFLAGS?=$(shell pkg-config lua$(lua) --libs 2>/dev/null || pkg-config lua5.3 --libs 2>/dev/null || echo -llua5.2)
INC_FLAGS+=$(shell pkg-config lua$(lua) --cflags 2>/dev/null || pkg-config lua5.3 --cflags 2>/dev/null || echo -I/usr/include/lua5.2)
endif
ifneq ($(prof),)
LDFLAGS+=-L../gperftools-2.5/.libs/ -lprofiler
TARGET_EXEC:=$(TARGET_EXEC)-profiled
endif
LDFLAGS+=-lstdc++
ifeq ($(shell uname -s 2>/dev/null),Haiku)
LDFLAGS+=-lnetwork
else
LDFLAGS+=-lstdc++fs -pthread -ldl
endif
SRC_DIRS ?= ./
SRCS=$(wildcard $(SRC_DIRS)*.cpp)
SRCS+=$(wildcard $(SRC_DIRS)apis/*.cpp)
SRCS+=$(wildcard $(SRC_DIRS)color/*.cpp)
SRCS+=$(wildcard $(SRC_DIRS)components/*.cpp)
SRCS+=$(wildcard $(SRC_DIRS)drivers/*.cpp)
SRCS+=$(wildcard $(SRC_DIRS)io/*.cpp)
SRCS+=$(wildcard $(SRC_DIRS)model/*.cpp)
SRCS+=$(wildcard $(SRC_DIRS)util/*.cpp)
ifeq ($(shell uname -s 2>/dev/null),Haiku)
SRCS+=$(wildcard $(SRC_DIRS)haiku/*.cpp)
endif
ifeq (, $(shell which wget))
SRCS := $(filter-out $(SRC_DIRS)drivers/internet_http.cpp,$(SRCS))
endif
BUILD_DIR ?= ./bin
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP -Wall -g --std=c++17 -O0 -Wl,--no-as-needed
$(TARGET_EXEC): $(OBJS)
$(CXX) $(OBJS) -o $@ $(LDFLAGS)
@echo done
# c++ source
-include $(DEPS)
$(BUILD_DIR)/%.cpp.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
system:
@echo downloading OpenComputers system files
mkdir -p system
svn checkout https://github.com/MightyPirates/OpenComputers/trunk/src/main/resources/assets/opencomputers/loot system/loot
wget https://raw.githubusercontent.com/MightyPirates/OpenComputers/master-MC1.7.10/src/main/resources/assets/opencomputers/lua/machine.lua -O system/machine.lua
wget https://raw.githubusercontent.com/MightyPirates/OpenComputers/master-MC1.7.10/src/main/resources/assets/opencomputers/lua/bios.lua -O system/bios.lua
wget https://raw.githubusercontent.com/MightyPirates/OpenComputers/master-MC1.7.10/src/main/resources/assets/opencomputers/font.hex -O system/font.hex
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR) $(TARGET_EXEC) $(TARGET_EXEC)-profiled