Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. # We borrow heavily from the kernel build setup, though we are simpler since
  2. # we don't have Kconfig tweaking settings on us.
  3. # The implicit make rules have it looking for RCS files, among other things.
  4. # We instead explicitly write all the rules we care about.
  5. # It's even quicker (saves ~200ms) to pass -r on the command line.
  6. MAKEFLAGS=-r
  7. # The source directory tree.
  8. srcdir := ..
  9. abs_srcdir := $(abspath $(srcdir))
  10. # The name of the builddir.
  11. builddir_name ?= .
  12. # The V=1 flag on command line makes us verbosely print command lines.
  13. ifdef V
  14. quiet=
  15. else
  16. quiet=quiet_
  17. endif
  18. # Specify BUILDTYPE=Release on the command line for a release build.
  19. BUILDTYPE ?= Release
  20. # Directory all our build output goes into.
  21. # Note that this must be two directories beneath src/ for unit tests to pass,
  22. # as they reach into the src/ directory for data with relative paths.
  23. builddir ?= $(builddir_name)/$(BUILDTYPE)
  24. abs_builddir := $(abspath $(builddir))
  25. depsdir := $(builddir)/.deps
  26. # Object output directory.
  27. obj := $(builddir)/obj
  28. abs_obj := $(abspath $(obj))
  29. # We build up a list of every single one of the targets so we can slurp in the
  30. # generated dependency rule Makefiles in one pass.
  31. all_deps :=
  32. CC.target ?= $(CC)
  33. CFLAGS.target ?= $(CPPFLAGS) $(CFLAGS)
  34. CXX.target ?= $(CXX)
  35. CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS)
  36. LINK.target ?= $(LINK)
  37. LDFLAGS.target ?= $(LDFLAGS)
  38. AR.target ?= $(AR)
  39. # C++ apps need to be linked with g++.
  40. LINK ?= $(CXX.target)
  41. # TODO(evan): move all cross-compilation logic to gyp-time so we don't need
  42. # to replicate this environment fallback in make as well.
  43. CC.host ?= gcc
  44. CFLAGS.host ?= $(CPPFLAGS_host) $(CFLAGS_host)
  45. CXX.host ?= g++
  46. CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host)
  47. LINK.host ?= $(CXX.host)
  48. LDFLAGS.host ?=
  49. AR.host ?= ar
  50. # Define a dir function that can handle spaces.
  51. # http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
  52. # "leading spaces cannot appear in the text of the first argument as written.
  53. # These characters can be put into the argument value by variable substitution."
  54. empty :=
  55. space := $(empty) $(empty)
  56. # http://stackoverflow.com/questions/1189781/using-make-dir-or-notdir-on-a-path-with-spaces
  57. replace_spaces = $(subst $(space),?,$1)
  58. unreplace_spaces = $(subst ?,$(space),$1)
  59. dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
  60. # Flags to make gcc output dependency info. Note that you need to be
  61. # careful here to use the flags that ccache and distcc can understand.
  62. # We write to a dep file on the side first and then rename at the end
  63. # so we can't end up with a broken dep file.
  64. depfile = $(depsdir)/$(call replace_spaces,$@).d
  65. DEPFLAGS = -MMD -MF $(depfile).raw
  66. # We have to fixup the deps output in a few ways.
  67. # (1) the file output should mention the proper .o file.
  68. # ccache or distcc lose the path to the target, so we convert a rule of
  69. # the form:
  70. # foobar.o: DEP1 DEP2
  71. # into
  72. # path/to/foobar.o: DEP1 DEP2
  73. # (2) we want missing files not to cause us to fail to build.
  74. # We want to rewrite
  75. # foobar.o: DEP1 DEP2 \
  76. # DEP3
  77. # to
  78. # DEP1:
  79. # DEP2:
  80. # DEP3:
  81. # so if the files are missing, they're just considered phony rules.
  82. # We have to do some pretty insane escaping to get those backslashes
  83. # and dollar signs past make, the shell, and sed at the same time.
  84. # Doesn't work with spaces, but that's fine: .d files have spaces in
  85. # their names replaced with other characters.
  86. define fixup_dep
  87. # The depfile may not exist if the input file didn't have any #includes.
  88. touch $(depfile).raw
  89. # Fixup path as in (1).
  90. sed -e "s|^$(notdir $@)|$@|" $(depfile).raw >> $(depfile)
  91. # Add extra rules as in (2).
  92. # We remove slashes and replace spaces with new lines;
  93. # remove blank lines;
  94. # delete the first line and append a colon to the remaining lines.
  95. sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\
  96. grep -v '^$$' |\
  97. sed -e 1d -e 's|$$|:|' \
  98. >> $(depfile)
  99. rm $(depfile).raw
  100. endef
  101. # Command definitions:
  102. # - cmd_foo is the actual command to run;
  103. # - quiet_cmd_foo is the brief-output summary of the command.
  104. quiet_cmd_cc = CC($(TOOLSET)) $@
  105. cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
  106. quiet_cmd_cxx = CXX($(TOOLSET)) $@
  107. cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
  108. quiet_cmd_touch = TOUCH $@
  109. cmd_touch = touch $@
  110. quiet_cmd_copy = COPY $@
  111. # send stderr to /dev/null to ignore messages when linking directories.
  112. cmd_copy = rm -rf "$@" && cp -af "$<" "$@"
  113. quiet_cmd_alink = AR($(TOOLSET)) $@
  114. cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
  115. quiet_cmd_alink_thin = AR($(TOOLSET)) $@
  116. cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
  117. # Due to circular dependencies between libraries :(, we wrap the
  118. # special "figure out circular dependencies" flags around the entire
  119. # input list during linking.
  120. quiet_cmd_link = LINK($(TOOLSET)) $@
  121. cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group
  122. # We support two kinds of shared objects (.so):
  123. # 1) shared_library, which is just bundling together many dependent libraries
  124. # into a link line.
  125. # 2) loadable_module, which is generating a module intended for dlopen().
  126. #
  127. # They differ only slightly:
  128. # In the former case, we want to package all dependent code into the .so.
  129. # In the latter case, we want to package just the API exposed by the
  130. # outermost module.
  131. # This means shared_library uses --whole-archive, while loadable_module doesn't.
  132. # (Note that --whole-archive is incompatible with the --start-group used in
  133. # normal linking.)
  134. # Other shared-object link notes:
  135. # - Set SONAME to the library filename so our binaries don't reference
  136. # the local, absolute paths used on the link command-line.
  137. quiet_cmd_solink = SOLINK($(TOOLSET)) $@
  138. cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS)
  139. quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
  140. cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
  141. # Define an escape_quotes function to escape single quotes.
  142. # This allows us to handle quotes properly as long as we always use
  143. # use single quotes and escape_quotes.
  144. escape_quotes = $(subst ','\'',$(1))
  145. # This comment is here just to include a ' to unconfuse syntax highlighting.
  146. # Define an escape_vars function to escape '$' variable syntax.
  147. # This allows us to read/write command lines with shell variables (e.g.
  148. # $LD_LIBRARY_PATH), without triggering make substitution.
  149. escape_vars = $(subst $$,$$$$,$(1))
  150. # Helper that expands to a shell command to echo a string exactly as it is in
  151. # make. This uses printf instead of echo because printf's behaviour with respect
  152. # to escape sequences is more portable than echo's across different shells
  153. # (e.g., dash, bash).
  154. exact_echo = printf '%s\n' '$(call escape_quotes,$(1))'
  155. # Helper to compare the command we're about to run against the command
  156. # we logged the last time we ran the command. Produces an empty
  157. # string (false) when the commands match.
  158. # Tricky point: Make has no string-equality test function.
  159. # The kernel uses the following, but it seems like it would have false
  160. # positives, where one string reordered its arguments.
  161. # arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
  162. # $(filter-out $(cmd_$@), $(cmd_$(1))))
  163. # We instead substitute each for the empty string into the other, and
  164. # say they're equal if both substitutions produce the empty string.
  165. # .d files contain ? instead of spaces, take that into account.
  166. command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\
  167. $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1))))
  168. # Helper that is non-empty when a prerequisite changes.
  169. # Normally make does this implicitly, but we force rules to always run
  170. # so we can check their command lines.
  171. # $? -- new prerequisites
  172. # $| -- order-only dependencies
  173. prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
  174. # Helper that executes all postbuilds until one fails.
  175. define do_postbuilds
  176. @E=0;\
  177. for p in $(POSTBUILDS); do\
  178. eval $$p;\
  179. E=$$?;\
  180. if [ $$E -ne 0 ]; then\
  181. break;\
  182. fi;\
  183. done;\
  184. if [ $$E -ne 0 ]; then\
  185. rm -rf "$@";\
  186. exit $$E;\
  187. fi
  188. endef
  189. # do_cmd: run a command via the above cmd_foo names, if necessary.
  190. # Should always run for a given target to handle command-line changes.
  191. # Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
  192. # Third argument, if non-zero, makes it do POSTBUILDS processing.
  193. # Note: We intentionally do NOT call dirx for depfile, since it contains ? for
  194. # spaces already and dirx strips the ? characters.
  195. define do_cmd
  196. $(if $(or $(command_changed),$(prereq_changed)),
  197. @$(call exact_echo, $($(quiet)cmd_$(1)))
  198. @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))"
  199. $(if $(findstring flock,$(word 1,$(cmd_$1))),
  200. @$(cmd_$(1))
  201. @echo " $(quiet_cmd_$(1)): Finished",
  202. @$(cmd_$(1))
  203. )
  204. @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
  205. @$(if $(2),$(fixup_dep))
  206. $(if $(and $(3), $(POSTBUILDS)),
  207. $(call do_postbuilds)
  208. )
  209. )
  210. endef
  211. # Declare the "all" target first so it is the default,
  212. # even though we don't have the deps yet.
  213. .PHONY: all
  214. all:
  215. # make looks for ways to re-generate included makefiles, but in our case, we
  216. # don't have a direct way. Explicitly telling make that it has nothing to do
  217. # for them makes it go faster.
  218. %.d: ;
  219. # Use FORCE_DO_CMD to force a target to run. Should be coupled with
  220. # do_cmd.
  221. .PHONY: FORCE_DO_CMD
  222. FORCE_DO_CMD:
  223. TOOLSET := target
  224. # Suffix rules, putting all outputs into $(obj).
  225. $(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
  226. @$(call do_cmd,cc,1)
  227. $(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
  228. @$(call do_cmd,cxx,1)
  229. $(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD
  230. @$(call do_cmd,cxx,1)
  231. $(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD
  232. @$(call do_cmd,cxx,1)
  233. $(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD
  234. @$(call do_cmd,cc,1)
  235. $(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD
  236. @$(call do_cmd,cc,1)
  237. # Try building from generated source, too.
  238. $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD
  239. @$(call do_cmd,cc,1)
  240. $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
  241. @$(call do_cmd,cxx,1)
  242. $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD
  243. @$(call do_cmd,cxx,1)
  244. $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD
  245. @$(call do_cmd,cxx,1)
  246. $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD
  247. @$(call do_cmd,cc,1)
  248. $(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD
  249. @$(call do_cmd,cc,1)
  250. $(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD
  251. @$(call do_cmd,cc,1)
  252. $(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD
  253. @$(call do_cmd,cxx,1)
  254. $(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD
  255. @$(call do_cmd,cxx,1)
  256. $(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD
  257. @$(call do_cmd,cxx,1)
  258. $(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD
  259. @$(call do_cmd,cc,1)
  260. $(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD
  261. @$(call do_cmd,cc,1)
  262. ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
  263. $(findstring $(join ^,$(prefix)),\
  264. $(join ^,DTraceProviderStub.target.mk)))),)
  265. include DTraceProviderStub.target.mk
  266. endif
  267. quiet_cmd_regen_makefile = ACTION Regenerating $@
  268. cmd_regen_makefile = cd $(srcdir); /home/erik/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/erik/Documents/workspace_brackets/a1_BME_Project_Ohm/om/node_modules/dtrace-provider/build/config.gypi -I/home/erik/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/erik/.node-gyp/10.15.3/include/node/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/erik/.node-gyp/10.15.3" "-Dnode_gyp_dir=/home/erik/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/home/erik/.node-gyp/10.15.3/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/erik/Documents/workspace_brackets/a1_BME_Project_Ohm/om/node_modules/dtrace-provider" "-Dnode_engine=v8" binding.gyp
  269. Makefile: $(srcdir)/../../../../../../.node-gyp/10.15.3/include/node/common.gypi $(srcdir)/../../../../../../.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp
  270. $(call do_cmd,regen_makefile)
  271. # "all" is a concatenation of the "all" targets from all the included
  272. # sub-makefiles. This is just here to clarify.
  273. all:
  274. # Add in dependency-tracking rules. $(all_deps) is the list of every single
  275. # target in our tree. Only consider the ones with .d (dependency) info:
  276. d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
  277. ifneq ($(d_files),)
  278. include $(d_files)
  279. endif