<commit_before>#
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Makefile: basic Makefile for manta compute engine
#
# This Makefile contains only repo-specific logic and uses included makefiles
# to supply common targets (javascriptlint, jsstyle, restdown, etc.), which are
# used by other repos as well. You may well need to rewrite most of this file,
# but you shouldn't need to touch the included makefiles.
#
# If you find yourself adding support for new targets that could be useful for
# other projects too, you should add these to the original versions of the
# included Makefiles (in eng.git) so that other teams can use them too.
#

#
# MARLIN BUILD SYSTEM
#
# The Marlin build system is substantially more complex than most Node module
# repositories because it represents several distinct but tightly coupled
# components with overlapping dependencies.  There are four logical groups of
# code:
#
#     agent/		Marlin agent code
#     jobsupervisor/	Marlin jobsupervisor service code
#     client/		Marlin (moray) client code
#     common/		Code used by all of the above
#
# We keep all these in the same repository because they are inherently tightly
# coupled (e.g., they share internal structure definitions in common code), and
# the git repository is a useful consistency abstraction.
#
# The main consumers of the Marlin client are muskie, mackerel, and developers
# installing this package on OS X to use the debugging tools against remote
# deployments.  In order to support these clients without pulling in the (many)
# additional dependencies required to support the rest of Marlin, the
# package.json at the root of this repository represents only the client package
# and contains only the dependencies required to run the client library and
# tools.
#
# The other two consumers are builds of the marlin agent and jobsupervisor
# image.  To build these, we construct a proto area by merging the above four
# directories and then build a tarball of that.  The agent and jobsupervisor
# tarballs are logically different, but they're currently built from the exact
# same proto area, which contains a single package.json that describes the union
# of each components' dependencies.  These could be separated in the future for
# cleanliness.
#
# Finally, developers also need to be able to run the tools and the test suite.
# The tools work when run either directly out of the repo or from the proto
# area, but the test suite must be run from the proto area, since the common
# package.json contains test suite dependencies as well.
#
# Because of all this, the "all" target in this repo builds both the client
# package at the root of this repository as well as the complete proto area.
#

#
# While we only support developing on SmartOS, where we have sdcnode builds
# available, it's convenient to be able to use tools like "mrjob" and the like
# from Mac laptops without having to set up a complete dev environment.
#
ifeq ($(shell uname -s),Darwin)
	USE_LOCAL_NODE=true
else
	USE_LOCAL_NODE=false
endif

#
# Tools
#
BASHSTYLE	 = $(NODE) dev/tools/bashstyle
CATEST		 = dev/tools/catest
CC      	 = gcc
SMF_DTD		 = dev/tools/service_bundle.dtd.1

#
# Files
#
COMPONENT_DIRS   = agent client common dev jobsupervisor
BASH_FILES	 = \
    agent/npm/postinstall.sh		\
    agent/npm/preuninstall.sh		\
    agent/sbin/logpush.sh		\
    agent/sbin/mragentconf		\
    agent/sbin/mrdeploycompute		\
    agent/sbin/mrgroups			\
    agent/sbin/mrlogexpire.sh		\
    agent/sbin/mrzone			\
    agent/sbin/mrzonedisable		\
    agent/sbin/mrzoneremove		\
    agent/sbin/mrzones			\
    client/sbin/mrjobreport		\
    client/sbin/mrerrors		\
    client/sbin/mrextractjob		\
    dev/tools/catest			\
    dev/tools/mru			\
    jobsupervisor/boot/configure.sh

DOC_FILES	 = index.restdown ops.restdown

JSON_DIRS        = $(COMPONENT_DIRS:%=%/package.json %/etc %/sapi_manifests)
JSON_DIRS	+= $(COMPONENT_DIRS:%=%/etc)
JSON_DIRS	+= $(COMPONENT_DIRS:%=%/sapi_manifests)
JSON_FILES	:= $(shell find $(JSON_DIRS) -name '*.json' 2>/dev/null)
JSON_FILES	+= jobsupervisor/sapi_manifests/marlin/template

JS_DIRS		 = $(COMPONENT_DIRS:%=%/lib)
JS_DIRS		+= $(COMPONENT_DIRS:%=%/dev)
JS_FILES	:= $(shell find $(JS_DIRS) -name '*.js' 2>/dev/null)
JS_FILES	+= \
    client/sbin/mrerrorsummary	\
    client/sbin/mrjob		\
    client/sbin/mrmeter 	\
    dev/tools/bashstyle		\
    dev/tools/mrpound		\
    jobsupervisor/sbin/mlocate

JSL_CONF_NODE	 = dev/tools/jsl.node.conf
JSL_FILES_NODE   = $(JS_FILES)
JSSTYLE_FILES	 = $(JS_FILES)
SMF_MANIFESTS_IN = \
    agent/smf/manifests/marlin-agent.xml.in \
    agent/smf/manifests/marlin-lackey.xml.in

#
# v8plus uses the CTF tools as part of its build, but they can safely be
# overridden here so that this works in dev zones without them.
#
NPM_ENV		 = MAKE_OVERRIDES="CTFCONVERT=/bin/true CTFMERGE=/bin/true"

include ./dev/tools/mk/Makefile.defs
include ./dev/tools/mk/Makefile.smf.defs

ifneq ($(USE_LOCAL_NODE),true)
    NODE_PREBUILT_VERSION = v0.8.25
    NODE_PREBUILT_TAG = zone

    include ./dev/tools/mk/Makefile.node_prebuilt.defs
else
    NPM_EXEC :=
    NPM = npm
endif

#
# Repo-specific targets
#
CFLAGS		+= -Wall -Werror
EXECS   	 = dev/test/mallocbomb/mallocbomb
CLEANFILES	+= $(EXECS)

#
# The default ("all") target is used by developers to build the client package
# at the root of the repo as well as the full proto area.
#
.PHONY: all
all: deps proto

#
# The "deps" target builds the Node dependency and the installs the npm
# dependencies of the *client* package.
#
.PHONY: deps
deps: | $(NPM_EXEC)
	$(NPM_ENV) $(NPM) --no-rebuild install

.PHONY: test
test: all
	$(CATEST) -a

dev/test/mallocbomb/mallocbomb: dev/test/mallocbomb/mallocbomb.c

DISTCLEAN_FILES += node_modules
<commit_msg>MANTA-1730 marlin "make clean" misses mallocbomb binary<commit_after>#
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
#
# Makefile: basic Makefile for manta compute engine
#
# This Makefile contains only repo-specific logic and uses included makefiles
# to supply common targets (javascriptlint, jsstyle, restdown, etc.), which are
# used by other repos as well. You may well need to rewrite most of this file,
# but you shouldn't need to touch the included makefiles.
#
# If you find yourself adding support for new targets that could be useful for
# other projects too, you should add these to the original versions of the
# included Makefiles (in eng.git) so that other teams can use them too.
#

#
# MARLIN BUILD SYSTEM
#
# The Marlin build system is substantially more complex than most Node module
# repositories because it represents several distinct but tightly coupled
# components with overlapping dependencies.  There are four logical groups of
# code:
#
#     agent/		Marlin agent code
#     jobsupervisor/	Marlin jobsupervisor service code
#     client/		Marlin (moray) client code
#     common/		Code used by all of the above
#
# We keep all these in the same repository because they are inherently tightly
# coupled (e.g., they share internal structure definitions in common code), and
# the git repository is a useful consistency abstraction.
#
# The main consumers of the Marlin client are muskie, mackerel, and developers
# installing this package on OS X to use the debugging tools against remote
# deployments.  In order to support these clients without pulling in the (many)
# additional dependencies required to support the rest of Marlin, the
# package.json at the root of this repository represents only the client package
# and contains only the dependencies required to run the client library and
# tools.
#
# The other two consumers are builds of the marlin agent and jobsupervisor
# image.  To build these, we construct a proto area by merging the above four
# directories and then build a tarball of that.  The agent and jobsupervisor
# tarballs are logically different, but they're currently built from the exact
# same proto area, which contains a single package.json that describes the union
# of each components' dependencies.  These could be separated in the future for
# cleanliness.
#
# Finally, developers also need to be able to run the tools and the test suite.
# The tools work when run either directly out of the repo or from the proto
# area, but the test suite must be run from the proto area, since the common
# package.json contains test suite dependencies as well.
#
# Because of all this, the "all" target in this repo builds both the client
# package at the root of this repository as well as the complete proto area.
#

#
# While we only support developing on SmartOS, where we have sdcnode builds
# available, it's convenient to be able to use tools like "mrjob" and the like
# from Mac laptops without having to set up a complete dev environment.
#
ifeq ($(shell uname -s),Darwin)
	USE_LOCAL_NODE=true
else
	USE_LOCAL_NODE=false
endif

#
# Tools
#
BASHSTYLE	 = $(NODE) dev/tools/bashstyle
CATEST		 = dev/tools/catest
CC      	 = gcc
SMF_DTD		 = dev/tools/service_bundle.dtd.1

#
# Files
#
COMPONENT_DIRS   = agent client common dev jobsupervisor
BASH_FILES	 = \
    agent/npm/postinstall.sh		\
    agent/npm/preuninstall.sh		\
    agent/sbin/logpush.sh		\
    agent/sbin/mragentconf		\
    agent/sbin/mrdeploycompute		\
    agent/sbin/mrgroups			\
    agent/sbin/mrlogexpire.sh		\
    agent/sbin/mrzone			\
    agent/sbin/mrzonedisable		\
    agent/sbin/mrzoneremove		\
    agent/sbin/mrzones			\
    client/sbin/mrjobreport		\
    client/sbin/mrerrors		\
    client/sbin/mrextractjob		\
    dev/tools/catest			\
    dev/tools/mru			\
    jobsupervisor/boot/configure.sh

DOC_FILES	 = index.restdown ops.restdown

JSON_DIRS        = $(COMPONENT_DIRS:%=%/package.json %/etc %/sapi_manifests)
JSON_DIRS	+= $(COMPONENT_DIRS:%=%/etc)
JSON_DIRS	+= $(COMPONENT_DIRS:%=%/sapi_manifests)
JSON_FILES	:= $(shell find $(JSON_DIRS) -name '*.json' 2>/dev/null)
JSON_FILES	+= jobsupervisor/sapi_manifests/marlin/template

JS_DIRS		 = $(COMPONENT_DIRS:%=%/lib)
JS_DIRS		+= $(COMPONENT_DIRS:%=%/dev)
JS_FILES	:= $(shell find $(JS_DIRS) -name '*.js' 2>/dev/null)
JS_FILES	+= \
    client/sbin/mrerrorsummary	\
    client/sbin/mrjob		\
    client/sbin/mrmeter 	\
    dev/tools/bashstyle		\
    dev/tools/mrpound		\
    jobsupervisor/sbin/mlocate

JSL_CONF_NODE	 = dev/tools/jsl.node.conf
JSL_FILES_NODE   = $(JS_FILES)
JSSTYLE_FILES	 = $(JS_FILES)
SMF_MANIFESTS_IN = \
    agent/smf/manifests/marlin-agent.xml.in \
    agent/smf/manifests/marlin-lackey.xml.in

#
# v8plus uses the CTF tools as part of its build, but they can safely be
# overridden here so that this works in dev zones without them.
#
NPM_ENV		 = MAKE_OVERRIDES="CTFCONVERT=/bin/true CTFMERGE=/bin/true"

include ./dev/tools/mk/Makefile.defs
include ./dev/tools/mk/Makefile.smf.defs

ifneq ($(USE_LOCAL_NODE),true)
    NODE_PREBUILT_VERSION = v0.8.25
    NODE_PREBUILT_TAG = zone

    include ./dev/tools/mk/Makefile.node_prebuilt.defs
else
    NPM_EXEC :=
    NPM = npm
endif

#
# Repo-specific targets
#
CFLAGS		+= -Wall -Werror
EXECS   	 = dev/test/mallocbomb/mallocbomb
CLEANFILES	+= $(EXECS)

#
# The default ("all") target is used by developers to build the client package
# at the root of the repo as well as the full proto area.
#
.PHONY: all
all: deps proto

#
# The "deps" target builds the Node dependency and the installs the npm
# dependencies of the *client* package.
#
.PHONY: deps
deps: | $(NPM_EXEC)
	$(NPM_ENV) $(NPM) --no-rebuild install

.PHONY: test
test: all
	$(CATEST) -a

dev/test/mallocbomb/mallocbomb: dev/test/mallocbomb/mallocbomb.c
CLEAN_FILES += dev/test/mallocbomb/mallocbomb

DISTCLEAN_FILES += node_modules

{'fraction_non_alphanumeric': 0.08423772609819122, 'fraction_numerical': 0.0024117140396210162, 'mean_word_length': 3.7046191247974067, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '1125246', 'n_tokens_mistral': 3936, 'n_tokens_neox': 3745, 'n_words': 1336}