Add -cc and --cflags options
This commit is contained in:
+3
-3
@@ -33,11 +33,11 @@ testmakefiles: $(TESTMAKEFILES)
|
|||||||
appmakefiles: $(APPMAKEFILES)
|
appmakefiles: $(APPMAKEFILES)
|
||||||
|
|
||||||
../%/Makefile.test: Makefile.test.template Makefile
|
../%/Makefile.test: Makefile.test.template Makefile
|
||||||
(cd $(dir $@); ../../etc/makemake.py --relpath --objext=-test.o --template ../../etc/Makefile.test.template . . ../../utils ../../drivers ../../drivers/test > Makefile.test)
|
(cd $(dir $@); ../../etc/makemake.py --cc="gcc" --cflags="" --relpath --objext=-test.o --template ../../etc/Makefile.test.template . . ../../utils ../../drivers ../../drivers/test > Makefile.test)
|
||||||
|
|
||||||
|
|
||||||
../%/Makefile: Makefile.template Makefile makemake.py
|
../%/Makefile: Makefile.template Makefile makemake.py
|
||||||
(cd $(dir $@); ../../etc/makemake.py --relpath --template ../../etc/Makefile.template . . ../../utils ../../fonts ../../drivers ../../drivers/avr > Makefile)
|
(cd $(dir $@); ../../etc/makemake.py --cc="avr-gcc" --cflags="-Os -mmcu=atmega32u2" --relpath --template ../../etc/Makefile.template . . ../../utils ../../fonts ../../drivers ../../drivers/avr > Makefile)
|
||||||
|
|
||||||
|
|
||||||
appfiledeps: $(APPFILEDEPS)
|
appfiledeps: $(APPFILEDEPS)
|
||||||
@@ -69,7 +69,7 @@ appcallgraph: $(APPCALLGRAPH)
|
|||||||
(cd $(dir $@); ../../etc/makemake.py --relpath --modules . . ../../drivers ../../drivers/avr ../../utils --exclude system > modules.d)
|
(cd $(dir $@); ../../etc/makemake.py --relpath --modules . . ../../drivers ../../drivers/avr ../../utils --exclude system > modules.d)
|
||||||
|
|
||||||
../%/callgraph.d: ../%/Makefile
|
../%/callgraph.d: ../%/Makefile
|
||||||
(cd $(dir $@); ../../etc/makemake.py --relpath --calls . . ../../drivers ../../drivers/avr ../../utils --exclude system > callgraph.d)
|
(cd $(dir $@); ../../etc/makemake.py --cc="avr-gcc" --cflags="-Os -mmcu=atmega32u2" --relpath --calls . . ../../drivers ../../drivers/avr ../../utils --exclude system > callgraph.d)
|
||||||
|
|
||||||
|
|
||||||
# Compile all the applications.
|
# Compile all the applications.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# Descr: Makefile for @PROJECT@
|
# Descr: Makefile for @PROJECT@
|
||||||
|
|
||||||
# Definitions.
|
# Definitions.
|
||||||
CC = avr-gcc
|
CC = @CC@
|
||||||
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g @INCLUDES@
|
CFLAGS = -mmcu=atmega32u2 -Os -Wall -Wstrict-prototypes -Wextra -g @INCLUDES@
|
||||||
OBJCOPY = avr-objcopy
|
OBJCOPY = avr-objcopy
|
||||||
SIZE = avr-size
|
SIZE = avr-size
|
||||||
|
|||||||
+16
-4
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""makemake V0.03
|
"""makemake V0.04
|
||||||
Copyright (c) 2010 Michael P. Hayes, UC ECE, NZ
|
Copyright (c) 2010 Michael P. Hayes, UC ECE, NZ
|
||||||
|
|
||||||
This program tries to make a Makefile from a template. Given a C file
|
This program tries to make a Makefile from a template. Given a C file
|
||||||
@@ -27,6 +27,8 @@ The --modules option also needs fixing. FIXME!
|
|||||||
There are special strings that are replaced in the template file:
|
There are special strings that are replaced in the template file:
|
||||||
@PROJECT@ Project name
|
@PROJECT@ Project name
|
||||||
@VPATH@ List of source directories
|
@VPATH@ List of source directories
|
||||||
|
@CC@ Compiler name
|
||||||
|
@CFLAGS@ Compiler flags
|
||||||
@INCLUDES@ List of include directories each prefixed by -I
|
@INCLUDES@ List of include directories each prefixed by -I
|
||||||
@SRC@ List of source files
|
@SRC@ List of source files
|
||||||
@OBJ@ List of object files
|
@OBJ@ List of object files
|
||||||
@@ -157,6 +159,8 @@ def makefile_print (options, template, maincfilename, filedeps,
|
|||||||
|
|
||||||
text = re.sub (r'@PROJECT@', project, text)
|
text = re.sub (r'@PROJECT@', project, text)
|
||||||
text = re.sub (r'@VPATH@', vpath, text)
|
text = re.sub (r'@VPATH@', vpath, text)
|
||||||
|
text = re.sub (r'@CC@', options.cc, text)
|
||||||
|
text = re.sub (r'@CFLAGS@', options.cflags, text)
|
||||||
text = re.sub (r'@INCLUDES@', includes, text)
|
text = re.sub (r'@INCLUDES@', includes, text)
|
||||||
text = re.sub (r'@SRC@', src, text)
|
text = re.sub (r'@SRC@', src, text)
|
||||||
|
|
||||||
@@ -386,6 +390,14 @@ def main(argv = None):
|
|||||||
default = '.out',
|
default = '.out',
|
||||||
help = 'executable file extension')
|
help = 'executable file extension')
|
||||||
|
|
||||||
|
parser.add_option('--cc', dest = 'cc',
|
||||||
|
default = 'gcc',
|
||||||
|
help = 'compiler name')
|
||||||
|
|
||||||
|
parser.add_option('--cflags', dest = 'cflags',
|
||||||
|
default = '',
|
||||||
|
help = 'CFLAGS')
|
||||||
|
|
||||||
parser.add_option('--relpath', action = 'store_true',
|
parser.add_option('--relpath', action = 'store_true',
|
||||||
dest = 'relpath', default = False,
|
dest = 'relpath', default = False,
|
||||||
help = 'use relative paths')
|
help = 'use relative paths')
|
||||||
@@ -440,9 +452,9 @@ def main(argv = None):
|
|||||||
print >> sys.stderr, 'Found C file ' + maincfilename
|
print >> sys.stderr, 'Found C file ' + maincfilename
|
||||||
|
|
||||||
includes = '-I' + ' -I'.join (search_list)
|
includes = '-I' + ' -I'.join (search_list)
|
||||||
cflags = '-mmcu=atmega32u2'
|
gcc = options.cc + ' ' + options.cflags + ' ' + includes
|
||||||
opts = '-Os'
|
|
||||||
gcc = 'avr-gcc' + ' ' + cflags + ' ' + opts + ' ' + includes
|
print >> sys.stderr, gcc
|
||||||
|
|
||||||
# Search main c file looking for header files included with #include
|
# Search main c file looking for header files included with #include
|
||||||
# and any header files included by the header files
|
# and any header files included by the header files
|
||||||
|
|||||||
Reference in New Issue
Block a user