mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 06:54:26 +03:00
native cosmopolitan build
This commit is contained in:
43
Makefile
43
Makefile
@@ -33,12 +33,8 @@ CONFIG_LTO=y
|
||||
#CONFIG_WERROR=y
|
||||
# force 32 bit build for some utilities
|
||||
#CONFIG_M32=y
|
||||
|
||||
ifdef CONFIG_DARWIN
|
||||
# use clang instead of gcc
|
||||
CONFIG_CLANG=y
|
||||
CONFIG_DEFAULT_AR=y
|
||||
endif
|
||||
# cosmopolitan build (see https://github.com/jart/cosmopolitan)
|
||||
#CONFIG_COSMO=y
|
||||
|
||||
# installation directory
|
||||
prefix=/usr/local
|
||||
@@ -52,6 +48,12 @@ CONFIG_BIGNUM=y
|
||||
|
||||
OBJDIR=.obj
|
||||
|
||||
ifdef CONFIG_DARWIN
|
||||
# use clang instead of gcc
|
||||
CONFIG_CLANG=y
|
||||
CONFIG_DEFAULT_AR=y
|
||||
endif
|
||||
|
||||
ifdef CONFIG_WIN32
|
||||
ifdef CONFIG_M32
|
||||
CROSS_PREFIX=i686-w64-mingw32-
|
||||
@@ -63,6 +65,7 @@ else
|
||||
CROSS_PREFIX=
|
||||
EXE=
|
||||
endif
|
||||
|
||||
ifdef CONFIG_CLANG
|
||||
HOST_CC=clang
|
||||
CC=$(CROSS_PREFIX)clang
|
||||
@@ -84,6 +87,14 @@ ifdef CONFIG_CLANG
|
||||
AR=$(CROSS_PREFIX)ar
|
||||
endif
|
||||
endif
|
||||
else ifdef CONFIG_COSMO
|
||||
CONFIG_LTO=
|
||||
HOST_CC=gcc
|
||||
CC=cosmocc
|
||||
# cosmocc does not correct support -MF
|
||||
CFLAGS=-g -Wall #-MMD -MF $(OBJDIR)/$(@F).d
|
||||
CFLAGS += -Wno-array-bounds -Wno-format-truncation
|
||||
AR=cosmoar
|
||||
else
|
||||
HOST_CC=gcc
|
||||
CC=$(CROSS_PREFIX)gcc
|
||||
@@ -113,7 +124,11 @@ CFLAGS_DEBUG=$(CFLAGS) -O0
|
||||
CFLAGS_SMALL=$(CFLAGS) -Os
|
||||
CFLAGS_OPT=$(CFLAGS) -O2
|
||||
CFLAGS_NOLTO:=$(CFLAGS_OPT)
|
||||
ifdef CONFIG_COSMO
|
||||
LDFLAGS=-s # better to strip by default
|
||||
else
|
||||
LDFLAGS=-g
|
||||
endif
|
||||
ifdef CONFIG_LTO
|
||||
CFLAGS_SMALL+=-flto
|
||||
CFLAGS_OPT+=-flto
|
||||
@@ -133,6 +148,12 @@ else
|
||||
LDEXPORT=-rdynamic
|
||||
endif
|
||||
|
||||
ifndef CONFIG_COSMO
|
||||
ifndef CONFIG_DARWIN
|
||||
CONFIG_SHARED_LIBS=y # building shared libraries is supported
|
||||
endif
|
||||
endif
|
||||
|
||||
PROGS=qjs$(EXE) qjsc$(EXE) run-test262
|
||||
ifneq ($(CROSS_PREFIX),)
|
||||
QJSC_CC=gcc
|
||||
@@ -157,10 +178,10 @@ endif
|
||||
ifeq ($(CROSS_PREFIX),)
|
||||
PROGS+=examples/hello
|
||||
ifndef CONFIG_ASAN
|
||||
PROGS+=examples/hello_module examples/test_fib
|
||||
ifndef CONFIG_DARWIN
|
||||
PROGS+=examples/fib.so examples/point.so
|
||||
PROGS+=examples/hello_module
|
||||
endif
|
||||
ifdef CONFIG_SHARED_LIBS
|
||||
PROGS+=examples/test_fib examples/fib.so examples/point.so
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -373,7 +394,7 @@ doc/%.html: doc/%.html.pre
|
||||
###############################################################################
|
||||
# tests
|
||||
|
||||
ifndef CONFIG_DARWIN
|
||||
ifdef CONFIG_SHARED_LIBS
|
||||
test: tests/bjson.so examples/point.so
|
||||
endif
|
||||
ifdef CONFIG_M32
|
||||
@@ -387,7 +408,7 @@ test: qjs
|
||||
./qjs tests/test_loop.js
|
||||
./qjs tests/test_std.js
|
||||
./qjs tests/test_worker.js
|
||||
ifndef CONFIG_DARWIN
|
||||
ifdef CONFIG_SHARED_LIBS
|
||||
ifdef CONFIG_BIGNUM
|
||||
./qjs --bignum tests/test_bjson.js
|
||||
else
|
||||
|
Reference in New Issue
Block a user