mirror of
https://github.com/bellard/quickjs.git
synced 2024-11-22 05:38:11 +08:00
allow override of PREFIX, CROSS_PREFIX, CFLAGS and LDFLAGS in Makefile (humenda)
This commit is contained in:
parent
efdb722f02
commit
6e651e86e5
36
Makefile
36
Makefile
@ -37,7 +37,7 @@ CONFIG_LTO=y
|
|||||||
#CONFIG_COSMO=y
|
#CONFIG_COSMO=y
|
||||||
|
|
||||||
# installation directory
|
# installation directory
|
||||||
prefix=/usr/local
|
PREFIX?=/usr/local
|
||||||
|
|
||||||
# use the gprof profiler
|
# use the gprof profiler
|
||||||
#CONFIG_PROFILE=y
|
#CONFIG_PROFILE=y
|
||||||
@ -56,20 +56,20 @@ endif
|
|||||||
|
|
||||||
ifdef CONFIG_WIN32
|
ifdef CONFIG_WIN32
|
||||||
ifdef CONFIG_M32
|
ifdef CONFIG_M32
|
||||||
CROSS_PREFIX=i686-w64-mingw32-
|
CROSS_PREFIX?=i686-w64-mingw32-
|
||||||
else
|
else
|
||||||
CROSS_PREFIX=x86_64-w64-mingw32-
|
CROSS_PREFIX?=x86_64-w64-mingw32-
|
||||||
endif
|
endif
|
||||||
EXE=.exe
|
EXE=.exe
|
||||||
else
|
else
|
||||||
CROSS_PREFIX=
|
CROSS_PREFIX?=
|
||||||
EXE=
|
EXE=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_CLANG
|
ifdef CONFIG_CLANG
|
||||||
HOST_CC=clang
|
HOST_CC=clang
|
||||||
CC=$(CROSS_PREFIX)clang
|
CC=$(CROSS_PREFIX)clang
|
||||||
CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
CFLAGS+=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||||
CFLAGS += -Wextra
|
CFLAGS += -Wextra
|
||||||
CFLAGS += -Wno-sign-compare
|
CFLAGS += -Wno-sign-compare
|
||||||
CFLAGS += -Wno-missing-field-initializers
|
CFLAGS += -Wno-missing-field-initializers
|
||||||
@ -98,7 +98,7 @@ else ifdef CONFIG_COSMO
|
|||||||
else
|
else
|
||||||
HOST_CC=gcc
|
HOST_CC=gcc
|
||||||
CC=$(CROSS_PREFIX)gcc
|
CC=$(CROSS_PREFIX)gcc
|
||||||
CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
CFLAGS+=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
|
||||||
CFLAGS += -Wno-array-bounds -Wno-format-truncation
|
CFLAGS += -Wno-array-bounds -Wno-format-truncation
|
||||||
ifdef CONFIG_LTO
|
ifdef CONFIG_LTO
|
||||||
AR=$(CROSS_PREFIX)gcc-ar
|
AR=$(CROSS_PREFIX)gcc-ar
|
||||||
@ -125,9 +125,9 @@ CFLAGS_SMALL=$(CFLAGS) -Os
|
|||||||
CFLAGS_OPT=$(CFLAGS) -O2
|
CFLAGS_OPT=$(CFLAGS) -O2
|
||||||
CFLAGS_NOLTO:=$(CFLAGS_OPT)
|
CFLAGS_NOLTO:=$(CFLAGS_OPT)
|
||||||
ifdef CONFIG_COSMO
|
ifdef CONFIG_COSMO
|
||||||
LDFLAGS=-s # better to strip by default
|
LDFLAGS+=-s # better to strip by default
|
||||||
else
|
else
|
||||||
LDFLAGS=-g
|
LDFLAGS+=-g
|
||||||
endif
|
endif
|
||||||
ifdef CONFIG_LTO
|
ifdef CONFIG_LTO
|
||||||
CFLAGS_SMALL+=-flto
|
CFLAGS_SMALL+=-flto
|
||||||
@ -221,11 +221,11 @@ $(QJSC): $(OBJDIR)/qjsc.host.o \
|
|||||||
|
|
||||||
endif #CROSS_PREFIX
|
endif #CROSS_PREFIX
|
||||||
|
|
||||||
QJSC_DEFINES:=-DCONFIG_CC=\"$(QJSC_CC)\" -DCONFIG_PREFIX=\"$(prefix)\"
|
QJSC_DEFINES:=-DCONFIG_CC=\"$(QJSC_CC)\" -DCONFIG_PREFIX=\"$(PREFIX)\"
|
||||||
ifdef CONFIG_LTO
|
ifdef CONFIG_LTO
|
||||||
QJSC_DEFINES+=-DCONFIG_LTO
|
QJSC_DEFINES+=-DCONFIG_LTO
|
||||||
endif
|
endif
|
||||||
QJSC_HOST_DEFINES:=-DCONFIG_CC=\"$(HOST_CC)\" -DCONFIG_PREFIX=\"$(prefix)\"
|
QJSC_HOST_DEFINES:=-DCONFIG_CC=\"$(HOST_CC)\" -DCONFIG_PREFIX=\"$(PREFIX)\"
|
||||||
|
|
||||||
$(OBJDIR)/qjsc.o: CFLAGS+=$(QJSC_DEFINES)
|
$(OBJDIR)/qjsc.o: CFLAGS+=$(QJSC_DEFINES)
|
||||||
$(OBJDIR)/qjsc.host.o: CFLAGS+=$(QJSC_HOST_DEFINES)
|
$(OBJDIR)/qjsc.host.o: CFLAGS+=$(QJSC_HOST_DEFINES)
|
||||||
@ -318,17 +318,17 @@ clean:
|
|||||||
rm -rf run-test262-debug run-test262-32
|
rm -rf run-test262-debug run-test262-32
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p "$(DESTDIR)$(prefix)/bin"
|
mkdir -p "$(DESTDIR)$(PREFIX)/bin"
|
||||||
$(STRIP) qjs qjsc
|
$(STRIP) qjs qjsc
|
||||||
install -m755 qjs qjsc "$(DESTDIR)$(prefix)/bin"
|
install -m755 qjs qjsc "$(DESTDIR)$(PREFIX)/bin"
|
||||||
ln -sf qjs "$(DESTDIR)$(prefix)/bin/qjscalc"
|
ln -sf qjs "$(DESTDIR)$(PREFIX)/bin/qjscalc"
|
||||||
mkdir -p "$(DESTDIR)$(prefix)/lib/quickjs"
|
mkdir -p "$(DESTDIR)$(PREFIX)/lib/quickjs"
|
||||||
install -m644 libquickjs.a "$(DESTDIR)$(prefix)/lib/quickjs"
|
install -m644 libquickjs.a "$(DESTDIR)$(PREFIX)/lib/quickjs"
|
||||||
ifdef CONFIG_LTO
|
ifdef CONFIG_LTO
|
||||||
install -m644 libquickjs.lto.a "$(DESTDIR)$(prefix)/lib/quickjs"
|
install -m644 libquickjs.lto.a "$(DESTDIR)$(PREFIX)/lib/quickjs"
|
||||||
endif
|
endif
|
||||||
mkdir -p "$(DESTDIR)$(prefix)/include/quickjs"
|
mkdir -p "$(DESTDIR)$(PREFIX)/include/quickjs"
|
||||||
install -m644 quickjs.h quickjs-libc.h "$(DESTDIR)$(prefix)/include/quickjs"
|
install -m644 quickjs.h quickjs-libc.h "$(DESTDIR)$(PREFIX)/include/quickjs"
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# examples
|
# examples
|
||||||
|
Loading…
Reference in New Issue
Block a user