-#!/usr/bin/python
+#!/usr/bin/env python
#
# Copyright (c) 2012 Yannick Brosseau <yannick.brosseau@gmail.com>
#
#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "./{headerFilename}"
-#ifdef __cplusplus
-extern "C"{{
-#endif /* __cplusplus */
-
-
#if !defined({includeGuard}) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define {includeGuard}
#endif /* {includeGuard} */
#include <lttng/tracepoint-event.h>
-
-#ifdef __cplusplus
-}}
-#endif /* __cplusplus */
-
"""
def __init__(self, filename, template):
self.outputFilename = filename
if 'CC' in os.environ:
cc = os.environ['CC']
try:
- subprocess.call(cc,
+ subprocess.call(cc.split(),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
except OSError as msg:
cc = self._detectCC()
if cc == "":
raise RuntimeError("No C Compiler detected")
+ if 'CPPFLAGS' in os.environ:
+ cppflags = " " + os.environ['CPPFLAGS']
+ else:
+ cppflags = ""
if 'CFLAGS' in os.environ:
- cflags = os.environ['CFLAGS']
+ cflags = " " + os.environ['CFLAGS']
else:
cflags = ""
+ if 'LDFLAGS' in os.environ:
+ ldflags = " " + os.environ['LDFLAGS']
+ else:
+ ldflags = ""
- command = cc + " -c " + cflags + " -I. -llttng-ust" + " -o " + self.outputFilename + " " + cFilename
+ command = cc + " -c" + cppflags + cflags + ldflags + " -I. -llttng-ust" + " -o " + self.outputFilename + " " + cFilename
if verbose:
print("Compile command: " + command)
subprocess.call(command.split())