summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 6405e4efb16caa3744639658d861e13a556fa210 (plain)
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
93
94
95
CWD = $(shell readlink -f .)
VERSION=0.4.1
SRCDIR=$(CWD)/SOURCES
BUILDDIR=$(CWD)/build
#WIND_BASE=$(CWD)/unpacked/tornado/2.2.1
#WIND_USR=$(WIND_BASE)/target
WIND_BASE=/master/tornado/2.2.1
WIND_USR=$(WIND_BASE)/target
GCC_TARGET=powerpc-wrs-vxworks
MASCH=$(shell uname -m)
GCC_PKGVERSION="TechSAT VxWorks 5.5/Tornado 2.2.1 Cross-Toolchain ($(MASCH)) v$(VERSION)"
INSTDIR=$(CWD)/inst/crossppc
PACKAGE=$(CWD)/crossppc-vxworks-$(VERSION)-bin-linux-$(MASCH).tar.gz

JOBS=-j4

all: prepare binutils xgcc pack clean

prepare:
	mkdir -p $(BUILDDIR)
	mkdir -p $(INSTDIR)
	rm -Rf $(CWD)/unpacked
	mkdir -p $(CWD)/unpacked
	cd $(CWD)/unpacked && \
		tar -zxf $(SRCDIR)/gcc-7.2.0.tar.gz
	cd $(CWD)/unpacked/gcc-7.2.0 && \
		patch -p1 < $(SRCDIR)/gcc72-vxworks.patch
	cd $(CWD)/unpacked/gcc-7.2.0 && \
		patch -p1 < $(SRCDIR)/gcc72-vxworks55-config.patch
	cd $(CWD)/unpacked/gcc-7.2.0 && \
		patch -p1 < $(SRCDIR)/gcc72-vxworks55-libgcc-config.patch
	cd $(CWD)/unpacked && \
		tar -zxf $(SRCDIR)/gmp-6.1.2.tar.gz
#	cd $(CWD)/unpacked && \
#		tar -zxf $(SRCDIR)/tornado-2.2.1.tar.gz 
	cd $(CWD)/unpacked && \
		tar -jxf $(SRCDIR)/binutils-2.29.tar.bz2
	cd $(CWD)/unpacked && \
		tar -jxf $(SRCDIR)/isl-0.18.tar.bz2
	cd $(CWD)/unpacked && \
		tar -zxf $(SRCDIR)/mpc-1.0.3.tar.gz
	cd $(CWD)/unpacked && \
		tar -jxf $(SRCDIR)/mpfr-3.1.6.tar.bz2
	mv $(CWD)/unpacked/gmp-6.1.2 $(CWD)/unpacked/gcc-7.2.0/gmp
	mv $(CWD)/unpacked/isl-0.18 $(CWD)/unpacked/gcc-7.2.0/isl
	mv $(CWD)/unpacked/mpc-1.0.3 $(CWD)/unpacked/gcc-7.2.0/mpc
	mv $(CWD)/unpacked/mpfr-3.1.6 $(CWD)/unpacked/gcc-7.2.0/mpfr

binutils:
	rm -Rf $(BUILDDIR)/binutils
	mkdir -p $(BUILDDIR)/binutils
	cd $(BUILDDIR)/binutils && \
		$(CWD)/unpacked/binutils-2.29/configure \
			--with-pkgversion=$(GCC_PKGVERSION) \
			--prefix=$(INSTDIR) \
			--target=$(GCC_TARGET) \
			--with-headers=$(WIND_BASE)/target/h
	cd $(BUILDDIR)/binutils && \
		make $(JOBS) && \
		make install-strip

xgcc:
	rm -Rf $(BUILDDIR)/gcc
	mkdir -p $(BUILDDIR)/gcc
	cd $(BUILDDIR)/gcc && \
		export WIND_BASE=$(WIND_BASE) && \
		export WIND_USR=$(WIND_USR) && \
		LDFLAGS="-static-libgcc -static-libstdc++" \
		$(CWD)/unpacked/gcc-7.2.0/configure \
			--with-pkgversion=$(GCC_PKGVERSION) \
			--prefix=$(INSTDIR) \
			--target=$(GCC_TARGET) \
			--with-headers=$(WIND_BASE)/target/h \
			--disable-plugin \
			--enable-languages="c,c++"  \
			--disable-multilib \
			--with-endian=big \
			--enable-threads=vxworks
	cd $(BUILDDIR)/gcc && \
		export WIND_BASE=$(WIND_BASE) && \
		export WIND_USR=$(WIND_USR) && \
		make $(JOBS) && \
		make install-strip
	rm -Rf $(INSTDIR)/$(GCC_TARGET)/sys-include

pack:
	cd $(INSTDIR) && \
		tar -zcf $(PACKAGE) .

clean:
	rm -Rf $(BUILDDIR)
	rm -Rf $(CWD)/unpacked
	rm -Rf $(CWD)/inst