Dave Hylands | 4646801 | 2014-01-08 10:15:39 -0800 | [diff] [blame] | 1 | ########## |
| 2 | # The following should eventually go into a more central location |
| 3 | # when a reorg is done. |
| 4 | # |
| 5 | # Turn on increased build verbosity by defining BUILD_VERBOSE in your main |
| 6 | # Makefile or in your environment. You can also use V=1 on the make command |
| 7 | # line. |
| 8 | ifeq ("$(origin V)", "command line") |
| 9 | BUILD_VERBOSE=$(V) |
| 10 | endif |
| 11 | ifndef BUILD_VERBOSE |
| 12 | BUILD_VERBOSE = 0 |
| 13 | endif |
| 14 | ifeq ($(BUILD_VERBOSE),0) |
| 15 | Q = @ |
| 16 | else |
| 17 | Q = |
| 18 | endif |
| 19 | # Since this is a new feature, advertise it |
| 20 | ifeq ($(BUILD_VERBOSE),0) |
| 21 | $(info Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.) |
| 22 | endif |
| 23 | # |
| 24 | ######### |
| 25 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 26 | # default settings; can be overriden in main Makefile |
| 27 | |
| 28 | ifndef PY_SRC |
| 29 | PY_SRC = ../py |
| 30 | endif |
| 31 | |
| 32 | ifndef BUILD |
| 33 | BUILD = build |
| 34 | endif |
| 35 | |
| 36 | # to create the build directory |
| 37 | |
| 38 | $(BUILD): |
Dave Hylands | 4646801 | 2014-01-08 10:15:39 -0800 | [diff] [blame] | 39 | $(Q)mkdir -p $@ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 40 | |
| 41 | # where py object files go (they have a name prefix to prevent filename clashes) |
| 42 | |
| 43 | PY_BUILD = $(BUILD)/py. |
| 44 | |
| 45 | # py object files |
| 46 | |
| 47 | PY_O_BASENAME = \ |
| 48 | nlrx86.o \ |
| 49 | nlrx64.o \ |
| 50 | nlrthumb.o \ |
| 51 | malloc.o \ |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 52 | gc.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 53 | qstr.o \ |
| 54 | vstr.o \ |
| 55 | unicode.o \ |
| 56 | lexer.o \ |
Damien George | 9193f89 | 2014-01-08 15:28:26 +0000 | [diff] [blame] | 57 | lexerstr.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 58 | lexerunix.o \ |
| 59 | parse.o \ |
| 60 | scope.o \ |
| 61 | compile.o \ |
| 62 | emitcommon.o \ |
| 63 | emitpass1.o \ |
| 64 | emitcpy.o \ |
| 65 | emitbc.o \ |
| 66 | asmx64.o \ |
| 67 | emitnx64.o \ |
| 68 | asmthumb.o \ |
| 69 | emitnthumb.o \ |
| 70 | emitinlinethumb.o \ |
| 71 | runtime.o \ |
| 72 | map.o \ |
xyb | c178ea4 | 2014-01-14 21:39:05 +0800 | [diff] [blame] | 73 | strtonum.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 74 | obj.o \ |
Paul Sokolovsky | 427905c | 2014-01-18 19:24:47 +0200 | [diff] [blame^] | 75 | objarray.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 76 | objbool.o \ |
| 77 | objboundmeth.o \ |
| 78 | objcell.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 79 | objclosure.o \ |
| 80 | objcomplex.o \ |
| 81 | objdict.o \ |
John R. Lenton | 9daa789 | 2014-01-14 23:55:01 +0000 | [diff] [blame] | 82 | objenumerate.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 83 | objexcept.o \ |
John R. Lenton | fca456b | 2014-01-15 01:37:08 +0000 | [diff] [blame] | 84 | objfilter.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 85 | objfloat.o \ |
| 86 | objfun.o \ |
| 87 | objgenerator.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 88 | objint.o \ |
Paul Sokolovsky | 966879c | 2014-01-17 20:01:36 +0200 | [diff] [blame] | 89 | objint_longlong.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 90 | objlist.o \ |
John R. Lenton | 39b174e | 2014-01-15 01:10:09 +0000 | [diff] [blame] | 91 | objmap.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 92 | objmodule.o \ |
| 93 | objnone.o \ |
| 94 | objrange.o \ |
| 95 | objset.o \ |
| 96 | objslice.o \ |
| 97 | objstr.o \ |
| 98 | objtuple.o \ |
| 99 | objtype.o \ |
Paul Sokolovsky | e98cf40 | 2014-01-08 02:43:48 +0200 | [diff] [blame] | 100 | stream.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 101 | builtin.o \ |
| 102 | builtinimport.o \ |
Damien George | d02c6d8 | 2014-01-15 22:14:03 +0000 | [diff] [blame] | 103 | builtineval.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 104 | vm.o \ |
| 105 | showbc.o \ |
| 106 | repl.o \ |
John R. Lenton | 07205ec | 2014-01-13 02:31:00 +0000 | [diff] [blame] | 107 | objzip.o \ |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 108 | |
| 109 | # prepend the build destination prefix to the py object files |
| 110 | |
| 111 | PY_O = $(addprefix $(PY_BUILD), $(PY_O_BASENAME)) |
| 112 | |
| 113 | $(PY_BUILD)emitnx64.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h |
Dave Hylands | 4646801 | 2014-01-08 10:15:39 -0800 | [diff] [blame] | 114 | $(ECHO) "CC $<" |
| 115 | $(Q)$(CC) $(CFLAGS) -DN_X64 -c -o $@ $< |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 116 | |
| 117 | $(PY_BUILD)emitnthumb.o: $(PY_SRC)/emitnative.c $(PY_SRC)/emit.h mpconfigport.h |
Dave Hylands | 4646801 | 2014-01-08 10:15:39 -0800 | [diff] [blame] | 118 | $(ECHO) "CC $<" |
| 119 | $(Q)$(CC) $(CFLAGS) -DN_THUMB -c -o $@ $< |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 120 | |
| 121 | $(PY_BUILD)%.o: $(PY_SRC)/%.S |
Dave Hylands | 4646801 | 2014-01-08 10:15:39 -0800 | [diff] [blame] | 122 | $(ECHO) "CC $<" |
| 123 | $(Q)$(CC) $(CFLAGS) -c -o $@ $< |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 124 | |
| 125 | $(PY_BUILD)%.o: $(PY_SRC)/%.c mpconfigport.h |
Dave Hylands | 4646801 | 2014-01-08 10:15:39 -0800 | [diff] [blame] | 126 | $(ECHO) "CC $<" |
| 127 | $(Q)$(CC) $(CFLAGS) -c -o $@ $< |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 128 | |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 129 | # optimising gc for speed; 5ms down to 4ms on pybv2 |
| 130 | $(PY_BUILD)gc.o: $(PY_SRC)/gc.c |
Dave Hylands | 4646801 | 2014-01-08 10:15:39 -0800 | [diff] [blame] | 131 | $(ECHO) "CC $<" |
| 132 | $(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $< |
Damien George | d3ebe48 | 2014-01-07 15:20:33 +0000 | [diff] [blame] | 133 | |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 134 | # optimising vm for speed, adds only a small amount to code size but makes a huge difference to speed (20% faster) |
| 135 | $(PY_BUILD)vm.o: $(PY_SRC)/vm.c |
Dave Hylands | 4646801 | 2014-01-08 10:15:39 -0800 | [diff] [blame] | 136 | $(ECHO) "CC $<" |
| 137 | $(Q)$(CC) $(CFLAGS) -O3 -c -o $@ $< |
Damien George | 136f675 | 2014-01-07 14:54:15 +0000 | [diff] [blame] | 138 | |
| 139 | # header dependencies |
| 140 | |
| 141 | $(PY_BUILD)parse.o: $(PY_SRC)/grammar.h |
| 142 | $(PY_BUILD)compile.o: $(PY_SRC)/grammar.h |
| 143 | $(PY_BUILD)/emitcpy.o: $(PY_SRC)/emit.h |
| 144 | $(PY_BUILD)emitbc.o: $(PY_SRC)/emit.h |