Skip to content

Commit 73e5c23

Browse files
committed
squash commits
1 parent b0df2e9 commit 73e5c23

9 files changed

+65
-173
lines changed
File renamed without changes.
File renamed without changes.
5.47 MB
Binary file not shown.
File renamed without changes.
File renamed without changes.

heap/src/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
jemalloc/
2+
simpleheap

heap/src/Makefile

Lines changed: 63 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
# Unified Makefile for simpleheap with static-linked jemalloc
22
#
33
# Usage:
4-
# make -f Makefile-jemalloc VERSION=5.3.0 ARCH=x64
5-
# make -f Makefile-jemalloc VERSION=4.5.0 ARCH=x32
4+
# make VERSION=5.3.0 ARCH=amd64
5+
# make VERSION=4.5.0 ARCH=i386
6+
# make VERSION=5.3.0 ARCH=arm64
7+
# make VERSION=5.3.0 ARCH=arm32
68
#
79
# Parameters:
810
# VERSION - jemalloc version (default: 5.3.0)
9-
# ARCH - target architecture: x64 or x32 (default: x64)
11+
# ARCH - target architecture: amd64, i386, arm64, or arm32 (default: amd64)
1012

1113
# Configuration parameters with defaults
1214
VERSION ?= 5.3.0
13-
ARCH ?= x64
15+
ARCH ?= amd64
1416

1517
# Validate ARCH
16-
ifneq ($(ARCH),x64)
17-
ifneq ($(ARCH),x32)
18-
$(error ARCH must be x64 or x32, got: $(ARCH))
18+
ifneq ($(ARCH),amd64)
19+
ifneq ($(ARCH),i386)
20+
ifneq ($(ARCH),arm64)
21+
ifneq ($(ARCH),arm32)
22+
$(error ARCH must be amd64, i386, arm64, or arm32, got: $(ARCH))
23+
endif
24+
endif
1925
endif
2026
endif
2127

@@ -25,16 +31,53 @@ JEMALLOC_BUILD = $(JEMALLOC_DIR)
2531
JEMALLOC_LIB = $(JEMALLOC_BUILD)/lib/libjemalloc.a
2632
JEMALLOC_INCLUDE = $(JEMALLOC_BUILD)/include
2733

34+
# Detect host architecture
35+
HOST_ARCH := $(shell uname -m)
36+
2837
# Compiler and flags
2938
CC = gcc
3039

3140
# Architecture-specific flags
32-
ifeq ($(ARCH),x32)
41+
ifeq ($(ARCH),i386)
42+
CC = gcc
3343
ARCH_CFLAGS = -m32
3444
ARCH_LDFLAGS = -m32
3545
AUTOGEN_ENV = CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32"
3646
AUTOGEN_ARGS = --host=i686-pc-linux-gnu
47+
else ifeq ($(ARCH),arm64)
48+
# Use native gcc if on arm64, otherwise cross-compile
49+
ifeq ($(HOST_ARCH),aarch64)
50+
CC = gcc
51+
ARCH_CFLAGS =
52+
ARCH_LDFLAGS =
53+
AUTOGEN_ENV =
54+
AUTOGEN_ARGS =
3755
else
56+
CC = aarch64-linux-gnu-gcc
57+
CXX = aarch64-linux-gnu-g++
58+
ARCH_CFLAGS =
59+
ARCH_LDFLAGS =
60+
AUTOGEN_ENV = CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
61+
AUTOGEN_ARGS = --host=aarch64-linux-gnu
62+
endif
63+
else ifeq ($(ARCH),arm32)
64+
# Use native gcc if on arm32, otherwise cross-compile
65+
ifeq ($(filter arm%,$(HOST_ARCH)),$(HOST_ARCH))
66+
CC = gcc
67+
ARCH_CFLAGS =
68+
ARCH_LDFLAGS =
69+
AUTOGEN_ENV =
70+
AUTOGEN_ARGS =
71+
else
72+
CC = arm-linux-gnueabihf-gcc
73+
CXX = arm-linux-gnueabihf-g++
74+
ARCH_CFLAGS =
75+
ARCH_LDFLAGS =
76+
AUTOGEN_ENV = CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++
77+
AUTOGEN_ARGS = --host=arm-linux-gnueabihf
78+
endif
79+
else
80+
CC = gcc
3881
ARCH_CFLAGS =
3982
ARCH_LDFLAGS =
4083
AUTOGEN_ENV =
@@ -54,9 +97,12 @@ all: $(TARGET)
5497

5598
# Clone jemalloc and checkout specified version
5699
$(JEMALLOC_DIR)/configure:
57-
git clone https://github.com/jemalloc/jemalloc $(JEMALLOC_DIR)
100+
@if [ ! -d $(JEMALLOC_DIR)/.git ]; then \
101+
git clone https://github.com/jemalloc/jemalloc $(JEMALLOC_DIR); \
102+
fi
58103
cd $(JEMALLOC_DIR) && git checkout $(VERSION)
59-
@echo "Jemalloc v$(VERSION) cloned and checked out"
104+
cd $(JEMALLOC_DIR) && autoconf
105+
@echo "Jemalloc v$(VERSION) ready"
60106

61107
jemalloc-clone: $(JEMALLOC_DIR)/configure
62108

@@ -98,11 +144,11 @@ help:
98144
@echo "Unified Makefile for simpleheap with jemalloc (static linking)"
99145
@echo ""
100146
@echo "Usage:"
101-
@echo " make -f Makefile-jemalloc [VERSION=x.y.z] [ARCH=x64|x32] [target]"
147+
@echo " make [VERSION=x.y.z] [ARCH=amd64|i386|arm64|arm32] [target]"
102148
@echo ""
103149
@echo "Parameters:"
104150
@echo " VERSION - jemalloc version to use (default: 5.3.0)"
105-
@echo " ARCH - target architecture: x64 or x32 (default: x64)"
151+
@echo " ARCH - target architecture: amd64, i386, arm64, or arm32 (default: amd64)"
106152
@echo ""
107153
@echo "Current settings:"
108154
@echo " VERSION = $(VERSION)"
@@ -120,6 +166,8 @@ help:
120166
@echo " help - Show this help"
121167
@echo ""
122168
@echo "Examples:"
123-
@echo " make -f Makefile-jemalloc VERSION=5.3.0 ARCH=x64"
124-
@echo " make -f Makefile-jemalloc VERSION=4.5.0 ARCH=x32"
125-
@echo " make -f Makefile-jemalloc VERSION=4.5.0 ARCH=x64 rebuild"
169+
@echo " make VERSION=5.3.0 ARCH=amd64"
170+
@echo " make VERSION=4.5.0 ARCH=i386"
171+
@echo " make VERSION=5.3.0 ARCH=arm64"
172+
@echo " make VERSION=5.3.0 ARCH=arm32"
173+
@echo " make VERSION=4.5.0 ARCH=amd64 rebuild"

heap/src/Makefile-jemalloc-5.3.0-static-x32

Lines changed: 0 additions & 79 deletions
This file was deleted.

heap/src/Makefile-jemalloc-5.3.0-static-x64

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)