-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21299 from JuliaLang/ihnorton-fix_embedding
fix embedding example, continued
- Loading branch information
Showing
21 changed files
with
149 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,25 @@ | ||
JULIAHOME := $(abspath ..) | ||
SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) | ||
BUILDDIR := . | ||
JULIAHOME := $(abspath $(SRCDIR)/..) | ||
include $(JULIAHOME)/Make.inc | ||
|
||
FLAGS = -Wall -Wno-strict-aliasing -fno-omit-frame-pointer \ | ||
-I$(JULIAHOME)/src -I$(JULIAHOME)/src/support -I$(build_includedir) $(CFLAGS) | ||
outdir := $(libexecdir) | ||
|
||
DEBUGFLAGS += $(FLAGS) | ||
SHIPFLAGS += $(FLAGS) | ||
JLDFLAGS += $(LDFLAGS) $(NO_WHOLE_ARCHIVE) $(call exec,$(LLVM_CONFIG) --ldflags) $(OSLIBS) $(RPATH) | ||
embedding_binary := $(abspath $(outdir)/embedding$(JULIA_LIBSUFFIX)$(EXE)) | ||
|
||
ifeq ($(USE_SYSTEM_LIBM),0) | ||
ifneq ($(UNTRUSTED_SYSTEM_LIBM),0) | ||
JLDFLAGS += $(WHOLE_ARCHIVE) $(build_libdir)/libopenlibm.a $(NO_WHOLE_ARCHIVE) | ||
endif | ||
endif | ||
release: embedding | ||
debug: embedding-debug | ||
|
||
embedding-release: embedding | ||
embedding: $(embedding_binary) | ||
embedding-debug: $(embedding_binary) | ||
|
||
release debug: | ||
$(MAKE) embedding-$@ | ||
$(embedding_binary): $(wildcard embedding/*) | ||
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/examples/embedding $(JULIA_BUILD_MODE) \ | ||
JULIA="$(bindir)/julia$(JULIA_LIBSUFFIX)$(EXE)" BIN="$(outdir)" \ | ||
SPAWN="$(spawn)" CC="$(CC)" | ||
|
||
%.o: %.c | ||
@$(call PRINT_CC, $(CC) $(CPPFLAGS) $(CFLAGS) $(SHIPFLAGS) -c $< -o $@) | ||
%.do: %.c | ||
@$(call PRINT_CC, $(CC) $(CPPFLAGS) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@) | ||
clean: | ||
-rm -f $(embedding_binary) $(embedding_binary)-debug | ||
|
||
embedding: $(build_bindir)/embedding$(EXE) | ||
embedding-debug: $(build_bindir)/embedding-debug$(EXE) | ||
|
||
$(build_bindir)/embedding$(EXE): embedding.o | ||
@$(call PRINT_LINK, $(CXX) $(LINK_FLAGS) $(SHIPFLAGS) $^ -o $@ -L$(build_private_libdir) -L$(build_shlibdir) -ljulia $(JLDFLAGS)) | ||
$(build_bindir)/embedding-debug$(EXE): embedding.do | ||
@$(call PRINT_LINK, $(CXX) $(LINK_FLAGS) $(DEBUGFLAGS) $^ -o $@ -L$(build_private_libdir) -L$(build_shlibdir) -ljulia-debug $(JLDFLAGS)) | ||
|
||
|
||
clean: | $(CLEAN_TARGETS) | ||
rm -f *.o *.do | ||
rm -f $(build_bindir)/embedding-debug $(build_bindir)/embedding | ||
|
||
.PHONY: clean release debug | ||
.PHONY: all embedding clean | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This Makefile template requires the following variables to be set | ||
# in the environment or on the command-line: | ||
# JULIA: path to julia[.exe] executable | ||
# BIN: binary build directory | ||
|
||
ifndef JULIA | ||
$(error "Please pass JULIA=[path of target julia binary], or set as environment variable!") | ||
endif | ||
ifndef BIN | ||
$(error "Please pass BIN=[path of build directory], or set as environment variable!") | ||
endif | ||
|
||
#============================================================================= | ||
# this source directory where embedding.c is located | ||
SRCDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) | ||
|
||
# get the executable suffix, if any | ||
EXE := $(suffix $(abspath $(JULIA))) | ||
|
||
# get compiler and linker flags. (see: `contrib/julia-config.jl`) | ||
CFLAGS += -lm $(shell $(SPAWN) $(JULIA) -e \ | ||
'include(joinpath(JULIA_HOME,Base.DATAROOTDIR,"julia","julia-config.jl"))' \ | ||
-- --cflags --ldflags --ldlibs) | ||
|
||
DEBUGFLAGS += -g | ||
|
||
#============================================================================= | ||
|
||
release: $(BIN)/embedding$(EXE) | ||
debug: $(BIN)/embedding-debug$(EXE) | ||
|
||
$(BIN)/embedding$(EXE): $(SRCDIR)/embedding.c | ||
$(CC) $^ -o $@ $(CFLAGS) | ||
|
||
$(BIN)/embedding-debug$(EXE): $(SRCDIR)/embedding.c | ||
$(CC) $^ -o $@ $(CFLAGS) $(DEBUGFLAGS) | ||
|
||
clean: | ||
@rm -f $(BIN)/embedding-debug$(EXE) $(BIN)/embedding$(EXE) | ||
|
||
.PHONY: release debug clean | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.