forked from pd95/m68k-atari-mint-cross-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.gcclibs
92 lines (74 loc) · 3.02 KB
/
Makefile.gcclibs
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
90
91
92
include VARS
PACKAGE_NAME=gcclibs
GMP=gmp-6.2.1
GMP_PATCH=gmp-6.2.1-macos.patch
MPFR=mpfr-4.2.0
MPC=mpc-1.3.1
SOURCE_DIR=$(BUILD_DIR)
COMPIL_DIR=$(BUILD_DIR)
BINARY_DIR=$(COMPIL_DIR)/gcclibs
LOCAL_PREFIX_DIR=$(BINARY_DIR)
# select gnu-tar if available
TAR=$(shell which gtar)
ifeq (, $(TAR))
TAR=tar
endif
##########################################
.PHONY: all gmp mpfr mpc
all: gmp mpfr mpc
mkdir -p "$(ARCHIVES_DIR)/gcclibs/$(ARCH)/"
cp -rf "$(BUILD_DIR)/gcclibs/"* "$(ARCHIVES_DIR)/gcclibs/$(ARCH)/"
clean:
ifeq "$(BUILD_DIR)" ""
@echo "BUILD_DIR is not set" && exit 1
endif
rm -rf "$(SOURCE_DIR)/$(GMP)"
rm -rf "$(COMPIL_DIR)/$(GMP)-$(VERSIONBINCPU)"
rm -rf "$(SOURCE_DIR)/$(MPFR)"
rm -rf "$(COMPIL_DIR)/$(MPFR)-$(VERSIONBINCPU)"
rm -rf "$(SOURCE_DIR)/$(MPC)"
rm -rf "$(COMPIL_DIR)/$(MPC)-$(VERSIONBINCPU)"
rm -rf "$(ARCHIVES_DIR)/gcclibs/$(ARCH)/"
##########################################
# Handle GMP
$(ARCHIVES_DIR)/$(GMP).tar.lz:
curl -o $(ARCHIVES_DIR)/$(notdir $@) -f "https://gmplib.org/download/gmp/$(notdir $@)"
$(SOURCE_DIR)/$(GMP): $(ARCHIVES_DIR)/$(GMP).tar.lz
$(TAR) xvf $< --directory=$(SOURCE_DIR)
cat $(ARCHIVES_DIR)/$(GMP_PATCH) | patch -p1 --directory $(SOURCE_DIR)/$(GMP)
$(COMPIL_DIR)/$(GMP)-$(VERSIONBINCPU)/Makefile: $(SOURCE_DIR)/$(GMP)
-mkdir -p $(dir $@)
cd "$(dir $@)" && \
$(SOURCE_DIR)/$(GMP)/configure --disable-shared --enable-static --prefix=$(LOCAL_PREFIX_DIR)
gmp: $(COMPIL_DIR)/$(GMP)-$(VERSIONBINCPU)/Makefile
make -j $(NUM_CPUS) --directory="$(COMPIL_DIR)/$(GMP)-$(VERSIONBINCPU)"
make --directory="$(COMPIL_DIR)/$(GMP)-$(VERSIONBINCPU)" check install
##########################################
# Handle MPFR
$(ARCHIVES_DIR)/$(MPFR).tar.bz2:
curl -o $(ARCHIVES_DIR)/$(notdir $@) -f "https://www.mpfr.org/mpfr-current/$(notdir $@)"
$(SOURCE_DIR)/$(MPFR): $(ARCHIVES_DIR)/$(MPFR).tar.bz2
$(TAR) xvf $< --directory=$(SOURCE_DIR)
$(COMPIL_DIR)/$(MPFR)-$(VERSIONBINCPU)/Makefile: $(SOURCE_DIR)/$(MPFR)
-mkdir $(dir $@)
cd "$(dir $@)" && \
$(SOURCE_DIR)/$(MPFR)/configure --disable-shared --enable-static --with-gmp=$(LOCAL_PREFIX_DIR) --prefix=$(LOCAL_PREFIX_DIR)
mpfr: $(COMPIL_DIR)/$(MPFR)-$(VERSIONBINCPU)/Makefile
make -j $(NUM_CPUS) --directory="$(COMPIL_DIR)/$(MPFR)-$(VERSIONBINCPU)"
make --directory="$(COMPIL_DIR)/$(MPFR)-$(VERSIONBINCPU)" check install
##########################################
# Handle MPC
$(ARCHIVES_DIR)/$(MPC).tar.gz:
curl -o $(ARCHIVES_DIR)/$(notdir $@) -f "https://ftp.gnu.org/gnu/mpc/$(notdir $@)"
$(SOURCE_DIR)/$(MPC): $(ARCHIVES_DIR)/$(MPC).tar.gz
$(TAR) xvf $< --directory=$(SOURCE_DIR)
$(COMPIL_DIR)/$(MPC)-$(VERSIONBINCPU)/Makefile: $(SOURCE_DIR)/$(MPC)
-mkdir $(dir $@)
cd "$(dir $@)" && \
$(SOURCE_DIR)/$(MPC)/configure --disable-shared --enable-static \
--with-gmp=$(LOCAL_PREFIX_DIR) \
--with-mpfr=$(LOCAL_PREFIX_DIR) \
--prefix=$(LOCAL_PREFIX_DIR)
mpc: $(COMPIL_DIR)/$(MPC)-$(VERSIONBINCPU)/Makefile
make -j $(NUM_CPUS) --directory="$(COMPIL_DIR)/$(MPC)-$(VERSIONBINCPU)"
make --directory="$(COMPIL_DIR)/$(MPC)-$(VERSIONBINCPU)" check install