blob: 1168242edac35f91bd25b8de3b3e87240a008d3e (
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# Copyright (C) 2007 Lauri Leukkunen <lle@rahina.org>
# Licensed under LGPL 2.1
TOPDIR = $(CURDIR)
OBJDIR = $(TOPDIR)
SRCDIR = $(TOPDIR)
VPATH = $(SRCDIR)
ifeq ($(MAKECMDGOALS),install-multilib)
BUILD_TARGET=multilib
else
BUILD_TARGET=$(targets)
endif
ifeq ($(shell uname -m),x86_64)
PRI_OBJDIR = obj-64
else
PRI_OBJDIR = obj-32
endif
CC = gcc
CXX = g++
LD = ld
PACKAGE_VERSION = "1.99.0.19"
PACKAGE = "SB2"
LIBSB2_SONAME = "libsb2.so.1"
LLBUILD ?= $(SRCDIR)/llbuild
# targets variable will be filled by llbuild
targets =
subdirs = mapping preload utils
-include config.mak
CFLAGS += -O2 -g -Wall -W -I$(OBJDIR)/include -I$(SRCDIR)/include -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1
CFLAGS += -DSCRATCHBOX_ROOT="$(prefix)"
CXXFLAGS =
include $(LLBUILD)/Makefile.include
export CC CFLAGS LDFLAGS CXX CXXFLAGS TOPDIR LLBUILD
ifdef prefix
CONFIGURE_ARGS = --prefix=$(prefix)
else
CONFIGURE_ARGS =
endif
all: $(targets)
multilib:
rm -rf obj-32 obj-64
mkdir -p obj-32
mkdir -p obj-64
cd obj-32 && \
CFLAGS=-m32 LDFLAGS=-m32 ../configure $(CONFIGURE_ARGS) && \
$(MAKE) --include-dir=.. -f ../Makefile SRCDIR=..
cd obj-64 && \
CFLAGS=-m64 LDFLAGS=-m64 ../configure $(CONFIGURE_ARGS) && \
$(MAKE) --include-dir=.. -f ../Makefile SRCDIR=..
gcc_bins = addr2line ar as cc c++ c++filt cpp g++ gcc gcov gdb gdbtui gprof ld nm objcopy objdump ranlib rdi-stub readelf run size strings strip
gcc_bins_expanded = $(foreach v,$(gcc_bins),$(prefix)/bin/host-$(v))
sources-release:
git archive --format=tar --prefix=sbox2-$(PACKAGE_VERSION)/ $(PACKAGE_VERSION) | bzip2 >sbox2-$(PACKAGE_VERSION).tar.bz2
install-noarch: $(BUILD_TARGET)
install -d -m 755 $(prefix)/bin
install -d -m 755 $(prefix)/share/scratchbox2/redir_scripts
install -d -m 755 $(prefix)/share/scratchbox2/redir_scripts/preload
install -d -m 755 $(prefix)/share/scratchbox2/redir_scripts/preload/complex
install -d -m 755 $(prefix)/share/scratchbox2/redir_scripts/preload/emulate
install -d -m 755 $(prefix)/share/scratchbox2/redir_scripts/preload/simple
install -d -m 755 $(prefix)/share/scratchbox2/scripts
install -d -m 755 $(prefix)/share/scratchbox2/tests
install -d -m 755 $(prefix)/share/man/man1
echo "$(PACKAGE_VERSION)" > $(prefix)/share/scratchbox2/version
install -c -m 755 $(SRCDIR)/utils/sb2 $(prefix)/bin/sb2
install -c -m 755 $(SRCDIR)/utils/sb2-init $(prefix)/bin/sb2-init
install -c -m 755 $(SRCDIR)/utils/sb2-config $(prefix)/bin/sb2-config
install -c -m 755 $(SRCDIR)/utils/sb2-build-libtool $(prefix)/bin/sb2-build-libtool
install -c -m 755 $(SRCDIR)/utils/dpkg-checkbuilddeps $(prefix)/share/scratchbox2/scripts/dpkg-checkbuilddeps
install -c -m 755 $(SRCDIR)/utils/dpkg-architecture $(prefix)/share/scratchbox2/scripts/dpkg-architecture
install -c -m 644 $(SRCDIR)/redir_scripts/main.lua $(prefix)/share/scratchbox2/redir_scripts/main.lua
install -c -m 644 $(SRCDIR)/redir_scripts/preload/complex/*.lua $(prefix)/share/scratchbox2/redir_scripts/preload/complex/
install -c -m 644 $(SRCDIR)/redir_scripts/preload/emulate/*.lua $(prefix)/share/scratchbox2/redir_scripts/preload/emulate/
install -c -m 644 $(SRCDIR)/redir_scripts/preload/simple/*.lua $(prefix)/share/scratchbox2/redir_scripts/preload/simple/
install -c -m 644 $(SRCDIR)/tests/* $(prefix)/share/scratchbox2/tests
chmod a+x $(prefix)/share/scratchbox2/tests/run.sh
install -c -m 644 $(SRCDIR)/docs/sb2.1 $(prefix)/share/man/man1/sb2.1
rm -f $(prefix)/share/scratchbox2/host_usr
ln -sf /usr $(prefix)/share/scratchbox2/host_usr
# remember to keep install and install-multilib in sync!
install: install-noarch
install -d -m 755 $(prefix)/lib
install -d -m 755 $(prefix)/lib/libsb2
install -c -m 755 $(OBJDIR)/preload/libsb2.so $(prefix)/lib/libsb2/libsb2.so.$(PACKAGE_VERSION)
install -c -m 755 $(OBJDIR)/utils/sb_gcc_wrapper $(prefix)/bin/sb_gcc_wrapper
@for f in $(gcc_bins_expanded); do \
ln -sf sb_gcc_wrapper $$f; \
done
/sbin/ldconfig -n $(prefix)/lib/libsb2
install-multilib: install-noarch
install -d -m 755 $(prefix)/lib32
install -d -m 755 $(prefix)/lib32/libsb2
install -d -m 755 $(prefix)/lib64
install -d -m 755 $(prefix)/lib64/libsb2
install -c -m 755 obj-32/preload/libsb2.so $(prefix)/lib32/libsb2/libsb2.so.$(PACKAGE_VERSION)
install -c -m 755 obj-64/preload/libsb2.so $(prefix)/lib64/libsb2/libsb2.so.$(PACKAGE_VERSION)
install -c -m 755 $(PRI_OBJDIR)/utils/sb_gcc_wrapper $(prefix)/bin/sb_gcc_wrapper
@for f in $(gcc_bins_expanded); do \
ln -sf sb_gcc_wrapper $$f; \
done
/sbin/ldconfig -n $(prefix)/lib32/libsb2 $(prefix)/lib64/libsb2
CLEAN_FILES += $(targets) config.status config.log
# make all object files depend on include/config.h
clean:
$(ll_clean)
|