<commit_before>--
-- make_cpp.lua
-- Generate a C/C++ project makefile.
-- Copyright (c) 2002-2011 <NAME> and the Premake project
--

	premake.make.cpp = { }
	local make = premake.make
	local cpp = premake.make.cpp
	local project = premake5.project
	local config = premake5.config


--
-- Generate a GNU make C++ project makefile, with support for the new platforms API.
--

	function make.cpp.generate(prj)
		cpp.header(prj)

		-- main build rule(s)
		_p('.PHONY: clean prebuild prelink')
		_p('')

		for cfg in project.eachconfig(prj) do
			cpp.config(cfg)
		end
		
		-- list intermediate files
		cpp.objects(prj)
		
		-- identify the shell type
		_p('SHELLTYPE := msdos')
		_p('ifeq (,$(ComSpec)$(COMSPEC))')
		_p('  SHELLTYPE := posix')
		_p('endif')
		_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
		_p('  SHELLTYPE := posix')
		_p('endif')
		_p('')

		-- common build target rules
		_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
		_p('\t@echo Linking %s', prj.name)
		_p('\t$(SILENT) $(LINKCMD)')
		_p('\t$(POSTBUILDCMDS)')
		_p('')

		make.mkdirrule("$(TARGETDIR)")
		make.mkdirrule("$(OBJDIR)")
	
		-- clean target
		_p('clean:')
		_p('\t@echo Cleaning %s', prj.name)
		_p('ifeq (posix,$(SHELLTYPE))')
		_p('\t$(SILENT) rm -f  $(TARGET)')
		_p('\t$(SILENT) rm -rf $(OBJDIR)')
		_p('else')
		_p('\t$(SILENT) if exist $(subst /,\\\\,$(TARGET)) del $(subst /,\\\\,$(TARGET))')
		_p('\t$(SILENT) if exist $(subst /,\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\,$(OBJDIR))')
		_p('endif')
		_p('')

		-- custom build step targets
		_p('prebuild:')
		_p('\t$(PREBUILDCMDS)')
		_p('')

		_p('prelink:')
		_p('\t$(PRELINKCMDS)')
		_p('')

		-- precompiler header rule
		cpp.pchrules(prj)

		-- file building rules
		cpp.filerules(prj)
		
		-- include the dependencies, built by GCC (with the -MMD flag)
		_p('-include $(OBJECTS:%%.o=%%.d)')
	end


--
-- Write out the C++ makefile header.
--

	function cpp.header(prj)
		-- a little help for the uninitiated
		_p('# %s C/C++ project makefile autogenerated by Premake', premake.action.current().shortname)
		_p('')

		make.defaultconfig(prj)
<commit_msg>Add include for PCH dependencies to makefiles<commit_after>--
-- make_cpp.lua
-- Generate a C/C++ project makefile.
-- Copyright (c) 2002-2011 <NAME> and the Premake project
--

	premake.make.cpp = { }
	local make = premake.make
	local cpp = premake.make.cpp
	local project = premake5.project
	local config = premake5.config


--
-- Generate a GNU make C++ project makefile, with support for the new platforms API.
--

	function make.cpp.generate(prj)
		cpp.header(prj)

		-- main build rule(s)
		_p('.PHONY: clean prebuild prelink')
		_p('')

		for cfg in project.eachconfig(prj) do
			cpp.config(cfg)
		end
		
		-- list intermediate files
		cpp.objects(prj)
		
		-- identify the shell type
		_p('SHELLTYPE := msdos')
		_p('ifeq (,$(ComSpec)$(COMSPEC))')
		_p('  SHELLTYPE := posix')
		_p('endif')
		_p('ifeq (/bin,$(findstring /bin,$(SHELL)))')
		_p('  SHELLTYPE := posix')
		_p('endif')
		_p('')

		-- common build target rules
		_p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(RESOURCES)')
		_p('\t@echo Linking %s', prj.name)
		_p('\t$(SILENT) $(LINKCMD)')
		_p('\t$(POSTBUILDCMDS)')
		_p('')

		make.mkdirrule("$(TARGETDIR)")
		make.mkdirrule("$(OBJDIR)")
	
		-- clean target
		_p('clean:')
		_p('\t@echo Cleaning %s', prj.name)
		_p('ifeq (posix,$(SHELLTYPE))')
		_p('\t$(SILENT) rm -f  $(TARGET)')
		_p('\t$(SILENT) rm -rf $(OBJDIR)')
		_p('else')
		_p('\t$(SILENT) if exist $(subst /,\\\\,$(TARGET)) del $(subst /,\\\\,$(TARGET))')
		_p('\t$(SILENT) if exist $(subst /,\\\\,$(OBJDIR)) rmdir /s /q $(subst /,\\\\,$(OBJDIR))')
		_p('endif')
		_p('')

		-- custom build step targets
		_p('prebuild:')
		_p('\t$(PREBUILDCMDS)')
		_p('')

		_p('prelink:')
		_p('\t$(PRELINKCMDS)')
		_p('')

		-- precompiler header rule
		cpp.pchrules(prj)

		-- file building rules
		cpp.filerules(prj)
		
		-- include the dependencies, built by GCC (with the -MMD flag)
		_p('-include $(OBJECTS:%%.o=%%.d)')
		_p('ifneq (,$(PCH))')
			_p('  -include $(OBJDIR)/$(notdir $(PCH)).d')
		_p('endif')
	end


--
-- Write out the C++ makefile header.
--

	function cpp.header(prj)
		-- a little help for the uninitiated
		_p('# %s C/C++ project makefile autogenerated by Premake', premake.action.current().shortname)
		_p('')

		make.defaultconfig(prj)

{'fraction_non_alphanumeric': 0.2122956481694681, 'fraction_numerical': 0.004605111673958094, 'mean_word_length': 3.3396603396603397, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2736309', 'n_tokens_mistral': 1954, 'n_tokens_neox': 1755, 'n_words': 407}