1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00

Update Makefile and build_win for better builds.

Use build/c/janet.c in both to prevent accidental inclusion
of build/janet.h (which may be stale) instead of the source headers.
This commit is contained in:
Calvin Rose 2021-01-31 09:59:53 -06:00
parent d122a75efd
commit 259d5fabd9
4 changed files with 17 additions and 14 deletions

3
.gitignore vendored
View File

@ -140,3 +140,6 @@ compile_commands.json
CTestTestfile.cmake CTestTestfile.cmake
# End of https://www.gitignore.io/api/cmake # End of https://www.gitignore.io/api/cmake
# Astyle
*.orig

View File

@ -66,7 +66,7 @@ ifeq ($(UNAME), Haiku)
LDFLAGS=-Wl,--export-dynamic LDFLAGS=-Wl,--export-dynamic
endif endif
$(shell mkdir -p build/core build/mainclient build/webclient build/boot) $(shell mkdir -p build/core build/c build/boot)
all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.h all: $(JANET_TARGET) $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) build/janet.h
###################### ######################
@ -149,7 +149,7 @@ build/janet_boot: $(JANET_BOOT_OBJECTS)
$(CC) $(BOOT_CFLAGS) -o $@ $(JANET_BOOT_OBJECTS) $(CLIBS) $(CC) $(BOOT_CFLAGS) -o $@ $(JANET_BOOT_OBJECTS) $(CLIBS)
# Now the reason we bootstrap in the first place # Now the reason we bootstrap in the first place
build/janet.c: build/janet_boot src/boot/boot.janet build/c/janet.c: build/janet_boot src/boot/boot.janet
build/janet_boot . JANET_PATH '$(JANET_PATH)' > $@ build/janet_boot . JANET_PATH '$(JANET_PATH)' > $@
cksum $@ cksum $@
@ -159,7 +159,7 @@ build/janet.c: build/janet_boot src/boot/boot.janet
SONAME=libjanet.so.1.14 SONAME=libjanet.so.1.14
build/shell.c: src/mainclient/shell.c build/c/shell.c: src/mainclient/shell.c
cp $< $@ cp $< $@
build/janet.h: $(JANET_TARGET) src/include/janet.h src/conf/janetconf.h build/janet.h: $(JANET_TARGET) src/include/janet.h src/conf/janetconf.h
@ -168,11 +168,11 @@ build/janet.h: $(JANET_TARGET) src/include/janet.h src/conf/janetconf.h
build/janetconf.h: src/conf/janetconf.h build/janetconf.h: src/conf/janetconf.h
cp $< $@ cp $< $@
build/janet.o: build/janet.c src/include/janet.h src/conf/janetconf.h build/janet.o: build/c/janet.c src/conf/janetconf.h src/include/janet.h
$(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@ -I build $(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@
build/shell.o: build/shell.c src/include/janet.h src/conf/janetconf.h build/shell.o: build/c/shell.c src/conf/janetconf.h src/include/janet.h
$(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@ -I build $(HOSTCC) $(BUILD_CFLAGS) -c $< -o $@
$(JANET_TARGET): build/janet.o build/shell.o $(JANET_TARGET): build/janet.o build/shell.o
$(HOSTCC) $(LDFLAGS) $(BUILD_CFLAGS) -o $@ $^ $(CLIBS) $(HOSTCC) $(LDFLAGS) $(BUILD_CFLAGS) -o $@ $^ $(CLIBS)
@ -224,7 +224,7 @@ dist: build/janet-dist.tar.gz
build/janet-%.tar.gz: $(JANET_TARGET) \ build/janet-%.tar.gz: $(JANET_TARGET) \
build/janet.h \ build/janet.h \
jpm.1 janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) \ jpm.1 janet.1 LICENSE CONTRIBUTING.md $(JANET_LIBRARY) $(JANET_STATIC_LIBRARY) \
build/doc.html README.md build/janet.c build/shell.c jpm build/doc.html README.md build/c/janet.c build/c/shell.c jpm
$(eval JANET_DIST_DIR = "janet-$(shell basename $*)") $(eval JANET_DIST_DIR = "janet-$(shell basename $*)")
mkdir -p build/$(JANET_DIST_DIR) mkdir -p build/$(JANET_DIST_DIR)
cp -r $^ build/$(JANET_DIST_DIR)/ cp -r $^ build/$(JANET_DIST_DIR)/

View File

@ -30,7 +30,7 @@ if not "%JANET_BUILD%" == "" (
if not exist build mkdir build if not exist build mkdir build
if not exist build\core mkdir build\core if not exist build\core mkdir build\core
if not exist build\mainclient mkdir build\mainclient if not exist build\c mkdir build\c
if not exist build\boot mkdir build\boot if not exist build\boot mkdir build\boot
@rem Build the bootstrap interpreter @rem Build the bootstrap interpreter
@ -44,10 +44,10 @@ for %%f in (src\boot\*.c) do (
) )
%JANET_LINK% /out:build\janet_boot.exe build\boot\*.obj %JANET_LINK% /out:build\janet_boot.exe build\boot\*.obj
@if errorlevel 1 goto :BUILDFAIL @if errorlevel 1 goto :BUILDFAIL
build\janet_boot . > build\janet.c build\janet_boot . > build\c\janet.c
@rem Build the sources @rem Build the sources
%JANET_COMPILE% /Fobuild\janet.obj build\janet.c %JANET_COMPILE% /Fobuild\janet.obj build\c\janet.c
@if errorlevel 1 goto :BUILDFAIL @if errorlevel 1 goto :BUILDFAIL
%JANET_COMPILE% /Fobuild\shell.obj src\mainclient\shell.c %JANET_COMPILE% /Fobuild\shell.obj src\mainclient\shell.c
@if errorlevel 1 goto :BUILDFAIL @if errorlevel 1 goto :BUILDFAIL
@ -102,9 +102,9 @@ exit /b 0
mkdir dist mkdir dist
janet.exe tools\gendoc.janet > dist\doc.html janet.exe tools\gendoc.janet > dist\doc.html
janet.exe tools\removecr.janet dist\doc.html janet.exe tools\removecr.janet dist\doc.html
janet.exe tools\removecr.janet build\janet.c janet.exe tools\removecr.janet build\c\janet.c
copy build\janet.c dist\janet.c copy build\c\janet.c dist\janet.c
copy src\mainclient\shell.c dist\shell.c copy src\mainclient\shell.c dist\shell.c
copy janet.exe dist\janet.exe copy janet.exe dist\janet.exe
copy LICENSE dist\LICENSE copy LICENSE dist\LICENSE