diff options
author | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-24 04:28:44 +0000 |
---|---|---|
committer | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-24 04:28:44 +0000 |
commit | e176ab0bfa35222ceeaa9bd3dde741dda98e095b (patch) | |
tree | d29d170c45eb302d50d2cf7b2e1b6c6e8da1b2af /native_client_sdk | |
parent | 1401fe93017bffc9584595a743d3ef6c966bfe79 (diff) | |
download | chromium_src-e176ab0bfa35222ceeaa9bd3dde741dda98e095b.zip chromium_src-e176ab0bfa35222ceeaa9bd3dde741dda98e095b.tar.gz chromium_src-e176ab0bfa35222ceeaa9bd3dde741dda98e095b.tar.bz2 |
Remove setting of TCNAME during example builds.
It was only used by hello_world and can be implemented
with the preprocessor.
BUG=
Review URL: https://chromiumcodereview.appspot.com/10879055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-x | native_client_sdk/src/build_tools/make_rules.py | 12 | ||||
-rw-r--r-- | native_client_sdk/src/examples/hello_world/hello_world.c | 30 |
2 files changed, 20 insertions, 22 deletions
diff --git a/native_client_sdk/src/build_tools/make_rules.py b/native_client_sdk/src/build_tools/make_rules.py index 18a6b39..b5c8823 100755 --- a/native_client_sdk/src/build_tools/make_rules.py +++ b/native_client_sdk/src/build_tools/make_rules.py @@ -62,18 +62,18 @@ WIN_CCFLAGS=/I$(NACL_SDK_ROOT)/include /I$(NACL_SDK_ROOT)/include/win -D WIN32 - # Compile rules for various platforms. # NACL_CC_RULES = { - 'Debug': '<TAB>$(<CC>) -o $@ $< -g -O0 <MACH> -DTCNAME=<tc> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLIST>', - 'Release': '<TAB>$(<CC>) -o $@ $< -O2 <MACH> -DTCNAME=<tc> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLIST>', + 'Debug': '<TAB>$(<CC>) -o $@ $< -g -O0 <MACH> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLIST>', + 'Release': '<TAB>$(<CC>) -o $@ $< -O2 <MACH> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLIST>', } SO_CC_RULES = { - 'Debug': '<TAB>$(<CC>) -o $@ $< -g -O0 <MACH> -fPIC -DTCNAME=<tcname> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLIST>', - 'Release': '<TAB>$(<CC>) -o $@ $< -O2 <MACH> -fPIC -DTCNAME=<tcname> $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLIST>' + 'Debug': '<TAB>$(<CC>) -o $@ $< -g -O0 <MACH> -fPIC $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLIST>', + 'Release': '<TAB>$(<CC>) -o $@ $< -O2 <MACH> -fPIC $(<TC>_CCFLAGS) $(<PROJ>_<EXT>FLAGS) <DEFLIST> <INCLIST>' } WIN_CC_RULES = { - 'Debug': '<TAB>$(<CC>) /Od /Fo$@ /MTd /Zi /c $< -DTCNAME=<tcname> $(WIN_CCFLAGS) <DEFLIST> <INCLIST>', - 'Release': '<TAB>$(<CC>) /O2 /Fo$@ /MT /c $< -DTCNAME=<tcname> $(WIN_CCFLAGS) <DEFLIST> <INCLIST>' + 'Debug': '<TAB>$(<CC>) /Od /Fo$@ /MTd /Zi /c $< $(WIN_CCFLAGS) <DEFLIST> <INCLIST>', + 'Release': '<TAB>$(<CC>) /O2 /Fo$@ /MT /c $< $(WIN_CCFLAGS) <DEFLIST> <INCLIST>' } # diff --git a/native_client_sdk/src/examples/hello_world/hello_world.c b/native_client_sdk/src/examples/hello_world/hello_world.c index 434386e..bbd0693 100644 --- a/native_client_sdk/src/examples/hello_world/hello_world.c +++ b/native_client_sdk/src/examples/hello_world/hello_world.c @@ -22,20 +22,17 @@ #include "ppapi/c/ppp_instance.h" #include "ppapi/c/ppp_messaging.h" -enum { - newlib = 0, - glibc = 1, - pnacl = 2, - host = 3, - TCMAX -}; - -static const char *s_TCNames[TCMAX] = { - "alert:Hello World (newlib)!", - "alert:Hello World (glibc)!", - "alert:Hello World (pnacl)!", - "alert:Hello World (host plugin)!", -}; +#if defined(__native_client__) +#if defined(__CLANG__) +#define TCNAME "pnacl" +#elif defined(__GLIBC__) +#define TCNAME "glibc" +#else +#define TCNAME "newlib" +#endif +#else +#define TCNAME "host" +#endif static PPB_Messaging* ppb_messaging_interface = NULL; static PPB_Var* ppb_var_interface = NULL; @@ -82,8 +79,9 @@ static PP_Bool Instance_DidCreate(PP_Instance instance, uint32_t argc, const char* argn[], const char* argv[]) { - ppb_messaging_interface->PostMessage(instance, - CStrToVar(s_TCNames[TCNAME])); + + const char* message = "alert:Hello World (" TCNAME ")!"; + ppb_messaging_interface->PostMessage(instance, CStrToVar(message)); return PP_TRUE; } |