-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMakefile
59 lines (46 loc) · 1.14 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
# cross compilation scheme taken from Eric Smith's spin2cpp compiler
# if CROSS is defined, we are building a cross compiler
# possible targets are: win32, rpi
ifeq ($(CC),)
CC=gcc
endif
ifeq ($(CXX),)
CXX=g++
endif
ifeq ($(CROSS),win32)
CC=i686-w64-mingw32-gcc
CXX=i686-w64-mingw32-g++
EXT=.exe
BUILD=./build-win32
else ifeq ($(CROSS),rpi)
CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++
EXT=
BUILD=./build-rpi
else
EXT=
BUILD=./build
endif
OS:=$(shell uname)
ifeq ($(OS),Darwin)
CFLAGS+=-Wall -g -Wno-self-assign
else
CFLAGS+=-Wall -g $(MSTATIC)
endif
CXXFLAGS += $(CFLAGS)
TARGET=$(BUILD)/openspin$(EXT)
SRCDIR=SpinSource
OBJ=$(BUILD)/openspin.o \
$(BUILD)/pathentry.o
LIBNAME=$(BUILD)/PropellerCompiler/libopenspin.a
all: $(BUILD) $(LIBNAME) $(OBJ) Makefile
$(CXX) -o $(TARGET) $(CXXFLAGS) $(OBJ) $(LIBNAME)
$(BUILD)/%.o: $(SRCDIR)/%.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
$(LIBNAME): $(BUILD)
$(MAKE) -C PropellerCompiler CROSS=$(CROSS) BUILD=$(realpath $(BUILD))/PropellerCompiler all
$(BUILD):
mkdir -p $(BUILD)
clean:
rm -rf $(BUILD)
make -C PropellerCompiler BUILD=$(realpath $(BUILD))/PropellerCompiler clean