2020-08-17 15:15:57 +02:00
|
|
|
############################################################################
|
2021-06-16 10:22:03 +02:00
|
|
|
# apps/interpreters/quickjs/Makefile
|
2020-08-17 15:15:57 +02:00
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
include $(APPDIR)/Make.defs
|
|
|
|
|
2021-03-12 10:10:54 +01:00
|
|
|
QUICKJS_VERSION = 2020-11-08
|
2020-08-17 15:15:57 +02:00
|
|
|
QUICKJS_UNPACK = quickjs
|
2021-03-12 10:10:54 +01:00
|
|
|
QUICKJS_TARBALL = quickjs-$(QUICKJS_VERSION).tar.xz
|
|
|
|
QUICKJS_URL_BASE = https://bellard.org/quickjs/
|
2020-08-17 15:15:57 +02:00
|
|
|
QUICKJS_URL = $(QUICKJS_URL_BASE)/$(QUICKJS_TARBALL)
|
|
|
|
|
2021-03-12 10:10:54 +01:00
|
|
|
CSRCS = quickjs.c libregexp.c libbf.c libunicode.c cutils.c
|
2020-08-17 15:15:57 +02:00
|
|
|
|
2021-03-15 11:56:18 +01:00
|
|
|
ifeq ($(CONFIG_INTERPRETERS_QUICKJS_MINI),y)
|
|
|
|
MAINSRC = qjsmini.c
|
|
|
|
else
|
|
|
|
CSRCS += quickjs-libc.c repl.c
|
2020-08-17 15:15:57 +02:00
|
|
|
MAINSRC = qjs.c
|
2021-03-15 11:56:18 +01:00
|
|
|
endif
|
2020-08-17 15:15:57 +02:00
|
|
|
|
2021-03-12 10:10:54 +01:00
|
|
|
VERSION=\"$(QUICKJS_VERSION)\"
|
2020-08-17 15:15:57 +02:00
|
|
|
|
2020-11-04 15:02:56 +01:00
|
|
|
CFLAGS += -DCONFIG_VERSION=$(VERSION) -Wno-shadow
|
2020-08-17 15:15:57 +02:00
|
|
|
CFLAGS += -Wno-array-bounds -I$(QUICKJS_UNPACK)
|
2021-03-12 10:10:54 +01:00
|
|
|
CFLAGS += -D__linux__ -include alloca.h
|
|
|
|
CFLAGS += -Wno-incompatible-pointer-types
|
|
|
|
CFLAGS += -Wno-implicit-function-declaration
|
|
|
|
CFLAGS += -Wno-unused-function
|
|
|
|
CFLAGS += -Wno-format
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ARCH_ARM),y)
|
|
|
|
CFLAGS += -DFE_TONEAREST=0x00000000
|
|
|
|
CFLAGS += -DFE_UPWARD=0x00400000
|
|
|
|
CFLAGS += -DFE_DOWNWARD=0x00800000
|
|
|
|
CFLAGS += -DFE_TOWARDZERO=0x00c00000
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_INTERPRETERS_QUICKJS_BIGNUM),y)
|
2020-08-17 15:15:57 +02:00
|
|
|
CFLAGS += -DCONFIG_BIGNUM
|
|
|
|
CSRCS += qjscalc.c
|
|
|
|
endif
|
|
|
|
|
|
|
|
VPATH += $(QUICKJS_UNPACK)
|
|
|
|
|
|
|
|
PROGNAME = qjs
|
|
|
|
PRIORITY = $(CONFIG_INTERPRETERS_QUICKJS_PRIORITY)
|
|
|
|
STACKSIZE = $(CONFIG_INTERPRETERS_QUICKJS_STACKSIZE)
|
|
|
|
MODULE = $(CONFIG_INTERPRETERS_QUICKJS)
|
|
|
|
|
|
|
|
$(QUICKJS_TARBALL):
|
|
|
|
$(Q) echo "Downloading $(QUICKJS_TARBALL)"
|
2020-12-21 12:48:58 +01:00
|
|
|
$(Q) curl -O -L $(QUICKJS_URL)
|
2020-08-17 15:15:57 +02:00
|
|
|
|
|
|
|
$(QUICKJS_UNPACK): $(QUICKJS_TARBALL)
|
|
|
|
$(Q) echo "Unpacking $(QUICKJS_TARBALL) to $(QUICKJS_UNPACK)"
|
2021-03-12 10:10:54 +01:00
|
|
|
$(Q) tar -Jxf $(QUICKJS_TARBALL)
|
2020-08-17 15:15:57 +02:00
|
|
|
$(Q) mv quickjs-$(QUICKJS_VERSION) $(QUICKJS_UNPACK)
|
2021-03-12 10:10:54 +01:00
|
|
|
$(Q) patch -d $(QUICKJS_UNPACK) -p1 < 0001-Disabled-unsupported-feature-on-NuttX.patch
|
2020-08-17 15:15:57 +02:00
|
|
|
|
|
|
|
$(QUICKJS_UNPACK)/.patch: $(QUICKJS_UNPACK)
|
|
|
|
$(Q) touch $(QUICKJS_UNPACK)/.patch
|
|
|
|
|
2021-03-12 10:10:54 +01:00
|
|
|
build_host: $(QUICKJS_UNPACK)/.patch
|
|
|
|
make -C $(QUICKJS_UNPACK) \
|
|
|
|
CONFIG_BIGNUM=$(CONFIG_INTERPRETERS_QUICKJS_BIGNUM)
|
|
|
|
|
|
|
|
context:: build_host
|
2020-08-17 15:15:57 +02:00
|
|
|
|
|
|
|
clean::
|
|
|
|
$(Q) test ! -d $(QUICKJS_UNPACK) || make -C $(QUICKJS_UNPACK) clean
|
|
|
|
|
|
|
|
distclean::
|
|
|
|
$(call DELDIR, $(QUICKJS_UNPACK))
|
|
|
|
$(call DELFILE, $(QUICKJS_TARBALL))
|
|
|
|
|
|
|
|
include $(APPDIR)/Application.mk
|