Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added some help and implemented -o and -ai flags, relnotes and versio…

…n bump
  • Loading branch information...
commit 3de49eeafe5a6a5df74971cd40c830b4cc7f4885 1 parent bff791f
Thomas Eriksson arnognulf authored Thomas Eriksson committed
55 contexo/cmdline/ctx2make.py
View
@@ -17,8 +17,6 @@
# TODO:
# * change output dir to absolute path, -o argument?
-# * translate msys/cygwin path to ntpath
-# * -ai additional includes ?
#
@@ -59,18 +57,21 @@
def main(argv):
exearg = False
buildTests = False
- exe = str()
assignCC = True
buildItems = list()
envFile = ""
viewDir = ""
bcFile = ""
+ addInc = ""
+ outputDir = ""
linkHeaders = True
nextArgIsEnv = False
nextArgIsBC = False
nextArgIsViewDir = False
+ nextArgIsAdditionalIncludes = False
+ nextArgIsOutputDir = False
parsedAllOptions = False
firstArg = True
@@ -80,9 +81,22 @@ def main(argv):
continue
if arg == '-h':
print >>sys.stderr, 'help:'
- print >>sys.stderr, '-l, symlink all headers to one directory and use that for include path'
+ print >>sys.stderr, '-b <BCFILE>, .bc file to use'
+ print >>sys.stderr, '-o <DIR>, output dir for Makefile, Makefile.cfg, Makefile.inc'
+ print >>sys.stderr, '-ai <DIR>, additional includes'
+ print >>sys.stderr, '-v <DIR>, override autodetection of view dir'
+ print >>sys.stderr, '-e <ENVFILE>, envfile'
+ print >>sys.stderr, '-nocc, disable setting the CC and CXX variables (use with scan-build)'
print >>sys.stderr, '-t, build tests'
sys.exit(1)
+ if nextArgIsOutputDir:
+ outputDir = arg
+ outputDir = outputDir.replace('\\','/')
+ if len(outputDir) > 0:
+ if outputDir[-1] != '/':
+ outputDir = outputDir + '/'
+ nextArgIsOutputDir = False
+ continue
if nextArgIsEnv:
envFile = arg
nextArgIsEnv = False
@@ -95,6 +109,13 @@ def main(argv):
bcFile = arg
nextArgIsBC = False
continue
+ if nextArgIsAdditionalIncludes:
+ if len(addInc) > 0:
+ print >>sys.stderr, 'only one \'-ai\' argument allowed'
+ sys.exit(1)
+ addInc = arg
+ nextArgIsAdditionalIncludes = False
+ continue
if not parsedAllOptions:
if arg == '-t':
buildTests = True
@@ -127,7 +148,7 @@ def main(argv):
sys.exit(1)
argDict = dict()
- genMakefile(viewDir = viewDir, envFile = envFile, bcFile = bcFile, buildItems = buildItems, buildTests = buildTests, linkHeaders = linkHeaders, assignCC = assignCC)
+ genMakefile(outputDir = outputDir, viewDir = viewDir, envFile = envFile, bcFile = bcFile, buildItems = buildItems, buildTests = buildTests, linkHeaders = linkHeaders, assignCC = assignCC, addInc = addInc)
logging.basicConfig(format = '%(asctime)s %(levelname)-8s %(message)s',
datefmt='%H:%M:%S',
@@ -291,7 +312,7 @@ def get_view_dir(args_view):
view_dir = posixpath.abspath('')
return view_dir
-def genMakefile(viewDir = str(), envFile = str(), bcFile = str(), buildItems = list(), buildTests = False, linkHeaders = False, assignCC = False):
+def genMakefile(outputDir = str(), viewDir = str(), envFile = str(), bcFile = str(), buildItems = list(), buildTests = False, linkHeaders = False, assignCC = False, addInc = str()):
launch_path = posixpath.abspath('.')
view_dir = get_view_dir(viewDir)
obj_dir = view_dir + os.sep + '.ctx/obj'
@@ -323,7 +344,7 @@ def genMakefile(viewDir = str(), envFile = str(), bcFile = str(), buildItems = l
dest = 'output' + os.sep + 'linkheaders'
linkIncludes(includes, dest, view_dir)
- writeMakefile(librarySources = librarySources, includes = includes, linkHeaders = linkHeaders, bc = bc, viewDir = view_dir, assignCC = assignCC)
+ writeMakefile(librarySources = librarySources, includes = includes, linkHeaders = linkHeaders, bc = bc, viewDir = view_dir, assignCC = assignCC, addInc = addInc)
if envFile != "":
switchEnvironment(oldEnv, False)
@@ -336,8 +357,7 @@ def linkIncludes(includes, dest, viewDir):
linkFile.write("/* Autogenerated by Contexo\n * changes to this file WILL BE LOST\n */\n")
linkFile.write("#include \"../../" + includeFile + "\"\n\n")
linkFile.close()
-def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = False, bc = None, viewDir = str(), assignCC = False):
- # TODO: hardcoded for now
+def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = False, bc = None, viewDir = str(), assignCC = False, addInc = str()):
libPrefix = bc.getCompiler().cdef['LIBPREFIX']
libSuffix = bc.getCompiler().cdef['LIBSUFFIX']
objSuffix = bc.getCompiler().cdef['OBJSUFFIX']
@@ -376,8 +396,8 @@ def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = Fals
subCxxFileSuffix = subBCObject.getCompiler().cdef['CXXFILESUFFIX']
break
- if not posixpath.isfile("Makefile.inc"):
- incmakefile = open("Makefile.inc", 'w')
+ if not posixpath.isfile(outputDir + "Makefile.inc"):
+ incmakefile = open(outputDir + "Makefile.inc", 'w')
incmakefile.write("### inc_all is built after all other projects is built\n")
incmakefile.write("### add dependencies for inc_all to add further build steps\n")
incmakefile.write("inc_all: $(LIBS)\n")
@@ -388,7 +408,7 @@ def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = Fals
incmakefile.close()
# Start writing to the file - using default settings for now
- makefile = open("Makefile", 'w')
+ makefile = open(outputDir + "Makefile", 'w')
# File header
makefile.write("#############################################\n")
@@ -400,8 +420,8 @@ def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = Fals
makefile.write("endif\n")
# config settings
- if not posixpath.isfile("Makefile.cfg"):
- cfgmakefile = open("Makefile.cfg", 'w')
+ if not posixpath.isfile(outputDir + "Makefile.cfg"):
+ cfgmakefile = open(outputDir + "Makefile.cfg", 'w')
cfgmakefile.write("### Compiler settings\n")
if assignCC:
cfgmakefile.write("CC=" + bc.getCompiler().cdef['CC'].replace('\\','/') + "\n")
@@ -427,6 +447,7 @@ def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = Fals
cfgmakefile.write("HDRDIR=$(OUTPUT)/inc\n")
cfgmakefile.write("LINKHEADERS=$(OUTPUT)/linkheaders\n")
cfgmakefile.write("DEPDIR=$(OUTPUT)/makedeps\n")
+ cfgmakefile.write("ADDINC=" + addInc + "\n")
cfgmakefile.write("\n")
cfgmakefile.write("EXPORT_CMD=cp\n")
@@ -531,7 +552,7 @@ def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = Fals
makefile.write("$(CYGPREFIX)$(OBJDIR)/" + posixpath.basename(basePath) + objSuffix + ": $(CYGPREFIX)" + sourceDependencyName + "\n")
makefile.write("\tRAW_SRC=$@;SRC_NOPREFIX=$${FOO#/};DRIVE=$${SRC_NOPREFIX%%/*};UNC_SRC=$${DRIVE}:/$${SRC_NOPREFIX#*/};")
makefile.write("OUTPUT=\"$<\";export CYGWIN=nodosfilewarning;SOURCEFILE=\"$*\";OBJFILE=\"$${SOURCEFILE%.*}\"" + objSuffix + ";makedepend -f-")
- makefile.write(" -I" + privIncPathForSourceFile(sourceDependencyName) + " -I\"$(LINKHEADERS)\" $< 2>/dev/null | sed \"s,.*:,\\$$(OBJDIR)/$${SOURCEFILE##*/}" + objSuffix + ":,\" > $(DEPDIR)/$${OUTPUT##*/}.d\n")
+ makefile.write(" -I" + privIncPathForSourceFile(sourceDependencyName) + " -I\"$(ADDINC)\" -I\"$(LINKHEADERS)\" $< 2>/dev/null | sed \"s,.*:,\\$$(OBJDIR)/$${SOURCEFILE##*/}" + objSuffix + ":,\" > $(DEPDIR)/$${OUTPUT##*/}.d\n")
# -e '/^C:/d'
if sourceDependencyName.count("/sub_bc/") > 0:
if sourceDependencyName[-len(subCxxFileSuffix):] == subCxxFileSuffix:
@@ -539,7 +560,7 @@ def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = Fals
else:
subCommandLine = "\t" + subCxxCommandLine
- subCommandLine = subCommandLine.replace("%INCPATHS", subIncPrefix + privIncPathForSourceFile(sourceDependencyName) + subIncSuffix + " " + subIncPrefix + "$(LINKHEADERS)" + subIncSuffix)
+ subCommandLine = subCommandLine.replace("%INCPATHS", subIncPrefix + addInc + subIncSuffix + " " + subIncPrefix + privIncPathForSourceFile(sourceDependencyName) + subIncSuffix + " " + subIncPrefix + "$(LINKHEADERS)" + subIncSuffix)
subCommandLine = subCommandLine.replace('%CPPDEFINES','$(SUB_PREP_DEFS)')
makefile.write(subCommandLine)
else:
@@ -548,7 +569,7 @@ def writeMakefile(librarySources = dict(), includes = list(), linkHeaders = Fals
else:
commandLine = "\t" + ccCommandLine
- commandLine = commandLine.replace("%INCPATHS", incPrefix + privIncPathForSourceFile(sourceDependencyName) + incSuffix + " " + incPrefix + "$(LINKHEADERS)" + incSuffix)
+ commandLine = commandLine.replace("%INCPATHS", incPrefix + addInc + incSuffix + " " + incPrefix + privIncPathForSourceFile(sourceDependencyName) + incSuffix + " " + incPrefix + "$(LINKHEADERS)" + incSuffix)
commandLine = commandLine.replace("%CPPDEFINES","$(PREP_DEFS)")
makefile.write(commandLine)
makefile.write("\n")
4 contexo/ctx_sysinfo.py
View
@@ -17,8 +17,8 @@
#
CTX_VER_MAJOR = 0
-CTX_VER_MINOR_1 = 16
-CTX_VER_MINOR_2 = 10
+CTX_VER_MINOR_1 = 17
+CTX_VER_MINOR_2 = 0
CTX_VER_STATE = ''
CTX_DISPLAYVERSION = '%d.%d.%d %s'%(CTX_VER_MAJOR, CTX_VER_MINOR_1, CTX_VER_MINOR_2, CTX_VER_STATE)
CTX_LICENSE = 'licesed under GPLv2 ( http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt )'
17 releasenotes.txt
View
@@ -1,3 +1,20 @@
+Contexo 0.17.0
+Feature: added the 'ctx2make' command.
+ This is basically a replacement for ctx+genmake, but designed to be much faster.
+ ctx2make is designed to be compatible with Windows, however, it has some external dependencies:
+
+ The following cygwin packages must be installed
+ make
+ makedepend
+ C:\cygwin\bin - must be added at the end of user environment variable PATH.
+
+ If the dependencies above are fulfilled, Makefiles produced with ctx2make can be built with
+ * MSys GNU make
+ * GNU make from rvct
+ * Cygwin GNU make
+ * Eclipse
+ * Netbeans
+
Contexo 0.16.10
Feature: genmake.py updates to correctly use CPPFLAGS [gustafp]
Please sign in to comment.
Something went wrong with that request. Please try again.