chromiumos/platform/common-mk.git
11 days agoAdd common test GYP include to setup gtest/gmock for test targets 29/50329/5 factory-4128.B factory-spring-4131.B master
Liam McLoughlin [Tue, 7 May 2013 17:41:40 +0000 (13:41 -0400)]
Add common test GYP include to setup gtest/gmock for test targets

BUG=chromium:220003
TEST=Run emerge-<board> -v platform2 with and without platform2 USE
flag on a range of boards plus the host

Change-Id: I1128ad8a91abeea2efcf76816a0ecf2f5ef3515a
Reviewed-on: https://gerrit.chromium.org/gerrit/50329
Commit-Queue: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
2 weeks agoAdd Platform2 GYP file and helpers 15/40315/34 release-R28-4100.B
Liam McLoughlin [Wed, 2 Jan 2013 03:04:25 +0000 (22:04 -0500)]
Add Platform2 GYP file and helpers

BUG=chromium:220003
TEST=Run emerge-<board> -v platform2 with and without platform2 USE
flag on a range of boards plus the host

Change-Id: Ib64951430025648044f039a46a62e001f9153035
Reviewed-on: https://gerrit.chromium.org/gerrit/40315
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

3 weeks agoEnable compilation without -fstack-protector-strong if this flag isn't supported... 29/48229/5 stabilize-4068.0.B
Ross McIlroy [Tue, 16 Apr 2013 17:00:49 +0000 (18:00 +0100)]
Enable compilation without -fstack-protector-strong if this flag isn't supported by gcc.

Use -fstack-protector-all in place of -fstack-protector-strong if
-fstack-protector-strong is not supported by compiler. This is required for
compilation of Chaps on Linux.

This CL also introduces a set of check_[cc,cxx], check_compile_[cc,cxx] macros
which can be used to check whether compiler flags are supported, or a given
test program can be compiled (e.g., to check for library availability).

TEST=Built the Chaps package both within the ChromeOS chroot (where gcc supports
     -fstack-protector-strong) and out-side the ChromeOS chroot (where Linux's
     gcc does not support -fstack-protector-strong) and confirm that flag is
     used appropriately.
BUG=None

Change-Id: I17a4ad1d7248afabf04c348d00ad1758a7e538c3
Signed-off-by: Ross McIlroy <rmcilroy@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/48229
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Tested-by: Ross McIlroy <rmcilroy@chromium.org>
2 months agocommon-mk: Added in test to profiling rule for empty file list 28/43928/4 factory-spring-3842.B firmware-spring-3824.4.B firmware-spring-3824.B firmware-spring-3833.B release-R27-3912.B stabilize-3881.0.B stabilize-4008.0.B stabilize-4035.0.B toolchainA
Ryan Harrison [Mon, 25 Feb 2013 20:03:42 +0000 (15:03 -0500)]
common-mk: Added in test to profiling rule for empty file list

For projects that do not have tests that are run with `make test` the profiling
phase of make test will fail since gcov doesn't know what to do with an empty
file list. This causes an issue, because for the cros_workon.eclass there is a
test rule that may be run, so it makes sense to make common.mk more robust.

BUG=chromium-os:39210
TEST=Built a package without implemented tests with tests turned on to confirm
     that the profiling step passed without doing anything.
     Built a package with implemented tests with tests turned on to confirmed
     profiling occured as expected.

Change-Id: Ia51179a721198c4615911b489fbd50f7289abcb5
Reviewed-on: https://gerrit.chromium.org/gerrit/43928
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Tested-by: Ryan Harrison <rharrison@chromium.org>
3 months agoChange reference to CXXFLAG to CXXFLAGS 69/42869/2 release-R26-3701.B stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-3701.81.B stabilize-bluetooth-smart toolchain-3701.42.B
Ryan Harrison [Thu, 7 Feb 2013 17:59:25 +0000 (12:59 -0500)]
Change reference to CXXFLAG to CXXFLAGS

This typo is the source of a variety of issues I have had upgrading packages to
use this version of common.mk. Suprisingly atleast 4 projects were able to build
correctly with this bug, so it might not be everywhere. I will check all of the
packages I have attempted to update for this.

BUG=chromium-os:37854
TEST=Copy common.mk into a variety of packages that depend on it and confirm
     that they build correctly with USE=profiling set

Change-Id: I2e344db744c89b40974afa9cf4880f0b4c2ff112
Reviewed-on: https://gerrit.chromium.org/gerrit/42869
Tested-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>

3 months agoAdd MODE=profiling to common.mk 30/42330/6
Ryan Harrison [Wed, 30 Jan 2013 19:35:13 +0000 (14:35 -0500)]
Add MODE=profiling to common.mk

This CL adds a new build mode, profiling, to common.mk. This mode sets the
various build flags to make binaries that produce profiling information. It also
disables optimization and run coverage analysis after the tests are
run. Currently the system runs gcov and lcov to generate two different forms of
coverage anaylsis.

CQ-DEPENDS=I4cb9b7d7772b15cdc930c827cd44cc5359380e7f
BUG=chromium-os:37854
TEST=Copied common.mk to power_manager for testing.
     Tried the various build methods:
     `MODE=profiling cros_workon_make --board=link power_manger`
     `MODE=profiling cros_workon_make --board=link power_manger --test`
     `cros_workon_make --board=link power_manger`
     `cros_workon_make --board=link power_manger --test`
     Repeated these with emerge-link power_manager and FEATURES=test as needed

Change-Id: Ie3849e80556e20b61e0dcab72ced2cccb1ab3bb6
Reviewed-on: https://gerrit.chromium.org/gerrit/42330
Tested-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>

8 months agooptimize mkdir calls factory-2846.B factory-2848.B factory-2914.B factory-2985.B factory-2993.B factory-3004.B factory-3536.B firmware-stout-2817.B release-R23-2913.B release-R25-3428.B stabilize stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize-3658.0.0 stabilize-daisy stabilize-link stabilize-link-2913.278 stabilize2 toolchain-3428.65.B
Mike Frysinger [Mon, 20 Aug 2012 21:17:53 +0000 (17:17 -0400)]
optimize mkdir calls

The vast majority of mkdir calls are not necessary as the dir in question
already exists.  Hoist the stat() call into the makefile level to avoid
the fork+exec most of the time.  In the rare case (the dir doesn't exist),
there's no real additional overhead.

We can also delete the main mkdir in the main wrapping target as we call
mkdir in global scope already:
# Make OUT now so we can use realpath.
$(shell mkdir -p "$(OUT)")

BUG=None
TEST=`./run_tests.sh` works
TEST=building mtpd in/out of tree with updated common.mk works

Change-Id: I26e9aa027d4f9e4c36a953f2002560f3ebc59f2a
Reviewed-on: https://gerrit.chromium.org/gerrit/31160
Reviewed-by: Will Drewry <wad@chromium.org>
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
8 months agoadd a default PKG_CONFIG setting
Mike Frysinger [Wed, 8 Aug 2012 21:21:05 +0000 (17:21 -0400)]
add a default PKG_CONFIG setting

While we don't execute it ourselves, most of our packages do, so setup
a sane default so every one else doesn't have to.

BUG=None
TEST=`./run_tests.sh` works

Change-Id: Id8404adbd7c50b6892be350086da8ca6f03396dc
Reviewed-on: https://gerrit.chromium.org/gerrit/29680
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
8 months agoallow run_tests.sh to enter the right dir
Mike Frysinger [Wed, 8 Aug 2012 20:59:08 +0000 (16:59 -0400)]
allow run_tests.sh to enter the right dir

If you run `./example/run_tests.sh`, it fails because it expects to
be started in the example dir directly.  Have the code cd to the dir
where the shell script lives automatically.

BUG=None
TEST=`./example/run_tests.sh` passes
TEST=`./run_tests.sh` passes

Change-Id: I2e00a61d3830a3776dabc2f52dd8ee74ee05fab3
Reviewed-on: https://gerrit.chromium.org/gerrit/29679
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
8 months agoadd an optional CROSS_COMPILE prefix
Mike Frysinger [Wed, 8 Aug 2012 20:54:33 +0000 (16:54 -0400)]
add an optional CROSS_COMPILE prefix

Nothing relies on this directly.  It just makes manual development
simpler as people can just run `make CROSS_COMPILE=xxx-` without
having to specify every CC/CXX/etc... variable.

Since some of these variables could be defined by default by make
while others are not, add a common function for processing either
state so we don't have to mentally keep a tally of it.

BUG=None
TEST=`./run_tests.sh` works

Change-Id: Ib1abc81b545aa47284cfec5c61da81d13c7644b1
Reviewed-on: https://gerrit.chromium.org/gerrit/29678
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
10 months agosupport clang compilers 76/26276/2 factory-2717.B factory-2723.14.B firmware-butterfly-2788.B firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B release-R22-2723.B
Mike Frysinger [Wed, 27 Jun 2012 22:24:58 +0000 (18:24 -0400)]
support clang compilers

Tweak some of the more exotic flags to the variants supported by clang.

BUG=chromium-os:32015
TEST=`./run_tests.sh` passed

Change-Id: I486b8404d9f17686185b802dfde221e304060465

12 months agoAdding Recipes to README 04/21804/2 factory-2268.16.B factory-2305.B factory-2338.B factory-2368.B factory-2394.B factory-2460.B factory-2475.B factory-2569.B firmware-link-2348.B release-R20-2268.B release-R21-2465.B
Ryan Harrison [Thu, 3 May 2012 20:36:20 +0000 (16:36 -0400)]
Adding Recipes to README

I originally wrote these for documentation of the Makefile in power_manager, but
it was suggested they would be better served here. I have reformatted them a bit
and make them a bit less power_manager specific.

BUG=chromium-os:30057
TEST=None, this is a documentation only change and thus should have no functional
     effect.

Change-Id: I1e0ee19450e087023b73507ae33725ebba3609ba

14 months agodrop outdated TODO 94/17694/1
Mike Frysinger [Fri, 9 Mar 2012 16:35:11 +0000 (11:35 -0500)]
drop outdated TODO

Seems like COMMON_CFLAGS already has -fvisibility=internal, and we
add that to CFLAGS/CXXFLAGS, so this TODO has been done.

BUG=None
TEST=None

Change-Id: I63467f1af5d758faa6405233fc20860ecd91282d

14 months agofix up toolchain flag handling 09/17109/2 factory-1987.B release-R19-2046.B
Mike Frysinger [Thu, 1 Mar 2012 00:00:00 +0000 (19:00 -0500)]
fix up toolchain flag handling

- respect $(CPPFLAGS) when compiling C/C++ code
- use $(CFLAGS) when compiling C code and not $(CXXFLAGS)
- use $(LDFLAGS) *before* objects and not after
- add $(LDLIBS) for specifying libraries

While we're here, convert from ssp-all to ssp-strong to match the rest
of the tree wide work we've done.

BUG=None
TEST=`./run_tests.sh` worked
TEST=`emerge-x86-alex cros-disks` worked

Change-Id: I7a47747d3dc4cd24d9240de00b2e17381fed1802

14 months ago[common-mk] add OWNERS 08/16508/1
Elly Jones [Thu, 23 Feb 2012 19:59:54 +0000 (14:59 -0500)]
[common-mk] add OWNERS

BUG=chromium-os:22007
TEST=None

Change-Id: I8d2e7dd252a18ca11c63b2b245e7a8c490cac6ef
Signed-off-by: Elly Jones <ellyjones@chromium.org>
15 months agocommon.mk: clean up depends files 84/14884/1 release-R18-1660.B
Will Drewry [Thu, 26 Jan 2012 16:36:28 +0000 (10:36 -0600)]
common.mk: clean up depends files

Ensures .depends files are cleaned up.

Signed-off-by: Will Drewry <wad@chromium.org>
BUG=none
TEST=run-tests.sh.  This code was accidentally left off of the last CL.

Change-Id: I3e2d663d5fb444f9435030cd2cd4f75c7e5e6ed8

15 months agocommon.mk: use object.depends instead of DEPENDS() 25/14625/1
Will Drewry [Mon, 23 Jan 2012 19:46:37 +0000 (13:46 -0600)]
common.mk: use object.depends instead of DEPENDS()

Changes the API away from DEPENDS() since it breaks freshness
analysis.

Use:
  foo.o.depends: blah.h
to add a foo.o dependency.

Signed-off-by: Will Drewry <wad@chromium.org>
BUG=none
TEST=run_tests.sh; touch files to check.

Change-Id: I9a0936b36626a635e5de04066334e0176beb4709

15 months agocommon.mk: add DEPENDS() target; fixes add_obj_rules 15/14615/2
Will Drewry [Mon, 23 Jan 2012 16:44:04 +0000 (10:44 -0600)]
common.mk: add DEPENDS() target; fixes add_obj_rules

This target ensures that object files may have dependencies specified
that are applied to all object-file related build artifacts:
  %.pic.o and %.pie.o

This will often be the case when checking for a system header or using
a generated header file from something like DBus.  It is invoked using:
  DEPENDS(component/subcomponent.o): mah_header.h

This change also makes add_object_rules default to searching the build path
unless $(SRC)/ is specified. Since common.mk users shouldn't generate new stuff
in $(SRC)/ this should default them to the same directory as the object file
they declare.

Signed-off-by: Will Drewry <wad@chromium.org>
BUG=chromium-os:25238
TEST=run_tests.sh

Change-Id: I7de615af68ba357d0f4b55c0135ae5ec2f728d98

16 months agofix usage with make-3.82+ 69/14169/1
Mike Frysinger [Fri, 13 Jan 2012 21:31:57 +0000 (16:31 -0500)]
fix usage with make-3.82+

Newer make fails with:
common.mk:146: *** mixed implicit and normal rules.  Stop.

BUG=chromium-os:24841
TEST=run_tests.sh passes with make-3.81 and make-3.82

Change-Id: Ie65067335b3571ae9c7b1adcd2e363cf16a81f65

16 months agocommon.mk: make pic and pie object file compilation parallel-friendly 43/13743/1
Will Drewry [Thu, 5 Jan 2012 22:13:51 +0000 (16:13 -0600)]
common.mk: make pic and pie object file compilation parallel-friendly

PIC and PIE object files were being generated serially inside one rule. This change breaks them out into individual rules which are still target-scoped, but pulled in as pre-requisites.  This allows make to handle them in parallel.

TEST=make in the example dir works as expected.
BUG=none; cmasone request :)

Change-Id: I5566b33266b4115a21b74d033c6484cafbe853da
(cherry picked from commit bc745a120d24258ac8a8659bac1bccf848c22c95)

16 months agocommon.mk: generalize code compilation rules. 58/13658/2
Will Drewry [Wed, 4 Jan 2012 19:52:51 +0000 (13:52 -0600)]
common.mk: generalize code compilation rules.

Added add_object_rules which may be called from an eval whenever
new objects need to have rules registered for them.

BUG=none
TEST=existing code still compiles as expected in the test suite.

Change-Id: Iae5ab94aad800ed05b9520cc02314cb289441713

17 months agocommon.mk: update for handful of issues with cros-disks integration 60/12360/2
Will Drewry [Thu, 1 Dec 2011 20:55:00 +0000 (14:55 -0600)]
common.mk: update for handful of issues with cros-disks integration

- Stop building to build-$(MODE) by default.
  Use PWD unless overridden.
- Make $(OUT) right away so we can $(realpath) it.
- Quoted shell-outs which use variables.  It will make things simpler if someone
  does decide to find cthulhu by adding support for spaces in files and paths.
- Cleaned up implicit rule replacement to actually work.
  (tested by dropping -r use, then restored it)
- dropped extra ARCH
- dropped pointless tests: definition
- Fixed LD_LIBRARY_PATH export for all tests
- Added arch specific GTEST_ARGS and comments about how to use them
- Update run_tests to reflect default OUT=$PWD

BUG=chromium-os:23064
TEST=see https://gerrit.chromium.org/gerrit/#change,11639
     also ran the run_tests.sh

Change-Id: I865267e976f9049f90cd9ba051dcbd1e418be76b

18 months agocommon.mk: overhaul (started in dm-verity.git but moved here) 32/11932/1 factory-1412.B release-R17-1412.B
Will Drewry [Fri, 18 Nov 2011 20:09:24 +0000 (14:09 -0600)]
common.mk: overhaul (started in dm-verity.git but moved here)

Overhauled common.mk to befit its shiny new repository:

  At present, common.mk requires that all build artifacts be
  prepended with $(OUT).  This is hideous and leads to common
  build/source leakage.

  This change moves make to run out of the build tree and set
  per target source resolution back to the source tree, instead of
  attempting to catch all object creation and send it to the build dir.

  It adds special archive target-based wrappers:
    CXX_BINARY, CXX_LIBRARY, . . .

  It adds a testing target wrapper and kills the dep-based test runner:
    TEST(target) or TEST(CXX_BINARY(target))

  It adds CLEAN(target) to replace RM helper variables.

  Moves to using .PHONY instead of FORCE across the board.

  Test running assumes CONFIG_COMPAT for x86_64 versus x86.

  (This includes NOSTRIP change from the cros-disks repo.)

  Removes all implicit rules not implemented in common.mk.

  Adds hooks to catch magic targets (CXX_*) from being used on accident
  without being properly defined (check_deps).

  Add hooks to catch CXX_LIBARY versus CXX_LIBRARY.

  Adds per-test-target NEEDS_ROOT and NEED_MOUNT helper variables.
   (Still not polished)

Adds an example hierarchy which also acts as a regression test suite.
(This was started in https://gerrit.chromium.org/gerrit/#change,11620
 but that was before there was this repo. So I'm moving authoritative work
 here and will use that cl and the cros-disks ones for sync only)

TEST=cd example; ./run_tests.sh
BUG=chromium-os:23064

Change-Id: I739295d6d1f30b87fd2ef06587c65e95a9c3ed14

18 months agocommon.mk: Add the existing authoritative common.mk 29/11929/1
Will Drewry [Fri, 18 Nov 2011 19:47:15 +0000 (13:47 -0600)]
common.mk: Add the existing authoritative common.mk

Copies common.mk from chaps/.  No changes done.

BUG=chromium-os:23064
TEST=none

Change-Id: I7845cd5a05187cd518932f824ee98b1709124d8e

18 months agoinit repo 04/11904/1
Will Drewry [Fri, 18 Nov 2011 15:48:52 +0000 (09:48 -0600)]
init repo