mirror of
https://github.com/janet-lang/janet
synced 2024-12-23 06:50:26 +00:00
Added NO_AMALG flag to Makefile to build janet from the individual
source files instead of from the amalgamated janet.c; this considerably speeds up parallel builds on modern CPUs
This commit is contained in:
parent
e97299fc65
commit
bb4ff05d35
25
Makefile
25
Makefile
@ -39,6 +39,8 @@ JANET_PATH?=$(LIBDIR)/janet
|
|||||||
JANET_MANPATH?=$(PREFIX)/share/man/man1/
|
JANET_MANPATH?=$(PREFIX)/share/man/man1/
|
||||||
JANET_PKG_CONFIG_PATH?=$(LIBDIR)/pkgconfig
|
JANET_PKG_CONFIG_PATH?=$(LIBDIR)/pkgconfig
|
||||||
JANET_DIST_DIR?=janet-dist
|
JANET_DIST_DIR?=janet-dist
|
||||||
|
JANET_BOOT_FLAGS:=. JANET_PATH '$(JANET_PATH)'
|
||||||
|
JANET_TARGET_OBJECTS=build/janet.o build/shell.o
|
||||||
JPM_TAG?=master
|
JPM_TAG?=master
|
||||||
DEBUGGER=gdb
|
DEBUGGER=gdb
|
||||||
SONAME_SETTER=-Wl,-soname,
|
SONAME_SETTER=-Wl,-soname,
|
||||||
@ -54,6 +56,12 @@ COMMON_CFLAGS:=-std=c99 -Wall -Wextra -Isrc/include -Isrc/conf -fvisibility=hidd
|
|||||||
BOOT_CFLAGS:=-DJANET_BOOTSTRAP -DJANET_BUILD=$(JANET_BUILD) -O0 $(COMMON_CFLAGS) -g
|
BOOT_CFLAGS:=-DJANET_BOOTSTRAP -DJANET_BUILD=$(JANET_BUILD) -O0 $(COMMON_CFLAGS) -g
|
||||||
BUILD_CFLAGS:=$(CFLAGS) $(COMMON_CFLAGS)
|
BUILD_CFLAGS:=$(CFLAGS) $(COMMON_CFLAGS)
|
||||||
|
|
||||||
|
# Disable amalgamated build
|
||||||
|
ifeq ($(JANET_NO_AMALG), 1)
|
||||||
|
JANET_TARGET_OBJECTS+=$(patsubst src/%.c,build/%.bin.o,$(JANET_CORE_SOURCES))
|
||||||
|
JANET_BOOT_FLAGS+=image-only
|
||||||
|
endif
|
||||||
|
|
||||||
# For installation
|
# For installation
|
||||||
LDCONFIG:=ldconfig "$(LIBDIR)"
|
LDCONFIG:=ldconfig "$(LIBDIR)"
|
||||||
|
|
||||||
@ -88,7 +96,7 @@ ifeq ($(findstring MINGW,$(UNAME)), MINGW)
|
|||||||
JANET_BOOT:=$(JANET_BOOT).exe
|
JANET_BOOT:=$(JANET_BOOT).exe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(shell mkdir -p build/core build/c build/boot)
|
$(shell mkdir -p build/core build/c build/boot build/mainclient)
|
||||||
all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.h
|
all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.h
|
||||||
|
|
||||||
######################
|
######################
|
||||||
@ -172,9 +180,16 @@ $(JANET_BOOT): $(JANET_BOOT_OBJECTS)
|
|||||||
|
|
||||||
# Now the reason we bootstrap in the first place
|
# Now the reason we bootstrap in the first place
|
||||||
build/c/janet.c: $(JANET_BOOT) src/boot/boot.janet
|
build/c/janet.c: $(JANET_BOOT) src/boot/boot.janet
|
||||||
$(RUN) $(JANET_BOOT) . JANET_PATH '$(JANET_PATH)' > $@
|
$(RUN) $(JANET_BOOT) $(JANET_BOOT_FLAGS) > $@
|
||||||
cksum $@
|
cksum $@
|
||||||
|
|
||||||
|
##################
|
||||||
|
##### Quicky #####
|
||||||
|
##################
|
||||||
|
|
||||||
|
build/%.bin.o: src/%.c $(JANET_HEADERS) $(JANET_LOCAL_HEADERS) Makefile
|
||||||
|
$(HOSTCC) $(BUILD_CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
########################
|
########################
|
||||||
##### Amalgamation #####
|
##### Amalgamation #####
|
||||||
########################
|
########################
|
||||||
@ -200,13 +215,13 @@ build/janet.o: build/c/janet.c $(JANETCONF_HEADER) src/include/janet.h
|
|||||||
build/shell.o: build/c/shell.c $(JANETCONF_HEADER) src/include/janet.h
|
build/shell.o: build/c/shell.c $(JANETCONF_HEADER) src/include/janet.h
|
||||||
$(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@
|
$(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(JANET_TARGET): build/janet.o build/shell.o
|
$(JANET_TARGET): $(JANET_TARGET_OBJECTS)
|
||||||
$(HOSTCC) $(LDFLAGS) $(BUILD_CFLAGS) -o $@ $^ $(CLIBS)
|
$(HOSTCC) $(LDFLAGS) $(BUILD_CFLAGS) -o $@ $^ $(CLIBS)
|
||||||
|
|
||||||
$(JANET_LIBRARY): build/janet.o build/shell.o
|
$(JANET_LIBRARY): $(JANET_TARGET_OBJECTS)
|
||||||
$(HOSTCC) $(LDFLAGS) $(BUILD_CFLAGS) $(SONAME_SETTER)$(SONAME) -shared -o $@ $^ $(CLIBS)
|
$(HOSTCC) $(LDFLAGS) $(BUILD_CFLAGS) $(SONAME_SETTER)$(SONAME) -shared -o $@ $^ $(CLIBS)
|
||||||
|
|
||||||
$(JANET_STATIC_LIBRARY): build/janet.o build/shell.o
|
$(JANET_STATIC_LIBRARY): $(JANET_TARGET_OBJECTS)
|
||||||
$(HOSTAR) rcs $@ $^
|
$(HOSTAR) rcs $@ $^
|
||||||
|
|
||||||
###################
|
###################
|
||||||
|
@ -4157,10 +4157,11 @@
|
|||||||
|
|
||||||
(defn do-one-file
|
(defn do-one-file
|
||||||
[fname]
|
[fname]
|
||||||
(print "\n/* " fname " */")
|
(if-not (has-value? boot/args "image-only") (do
|
||||||
(print "#line 0 \"" fname "\"\n")
|
(print "\n/* " fname " */")
|
||||||
(def source (slurp fname))
|
(print "#line 0 \"" fname "\"\n")
|
||||||
(print (string/replace-all "\r" "" source)))
|
(def source (slurp fname))
|
||||||
|
(print (string/replace-all "\r" "" source)))))
|
||||||
|
|
||||||
(do-one-file feature-header)
|
(do-one-file feature-header)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user