Update all files committed against this year with additional copyright years.
[freeems-vanilla.git] / src / Makefile.windows
blob8bb4ad081e5fe8589398887efa35ae8254401ffb
1 #       FreeEMS - the open source engine management system
3 #       Copyright 2008, 2009, 2010 Fred Cooke
5 #       This Makefile is part of the FreeEMS project.
7 #       FreeEMS software is free software: you can redistribute it and/or modify
8 #       it under the terms of the GNU General Public License as published by
9 #       the Free Software Foundation, either version 3 of the License, or
10 #       (at your option) any later version.
12 #       FreeEMS software is distributed in the hope that it will be useful,
13 #       but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #       GNU General Public License for more details.
17 #       You should have received a copy of the GNU General Public License
18 #       along with any FreeEMS software.  If not, see http://www.gnu.org/licenses/
20 #       We ask that if you make any changes to this file you email them upstream to
21 #       us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
23 #       Thank you for choosing FreeEMS to run your engine!
26 #                                                                              #
27 #   This Makefile is designed to be run with GNU make! Accept no substitute!   #
28 #                                                                              #
29 #                                                                              #
30 #   Top level targets:                                                         #
31 #                                                                              #
32 #   make:                                                                      #
33 #       Builds all output files in the slow multi stage way with all debugging #
34 #   make fast:                                                                 #
35 #       Compiles from C straight to objects, links to elfs and copies to s19s  #
36 #   make clean:                                                                #
37 #       Permanently removes all build artifact files and directories           #
38 #   make release:                                                              #
39 #       Cleans the project, builds it from scratch, copies the s19 files up to #
40 #       the firmware directory, zips each s19 separately, zips all of the      #
41 #       documentation, cleans the project again and lastly zips the entire     #
42 #       project directory                                                      #
43 #                                                                              #
44 #                                                                              #
45 #   When doing a full build the following steps are taken:                     #
46 #                                                                              #
47 #    1) Pre-process all of the C files                                         #
48 #    2) Compile all preprocessed C files into assembly files                   #
49 #    3) Assemble all assembly files into object files                          #
50 #    4) Dump the contents of all object files                                  #
51 #    5) Link one decoder with garbage collection and reporting turned on       #
52 #    6) Link each decoder without garbage collection                           #
53 #    7) Dump the contents of each decoders elf                                 #
54 #    8) Produce a memory map for each elf                                      #
55 #    9) Produce a readelf dump for each elf                                    #
56 #   10) Produce an s19 loadable firmware file for each elf                     #
57 #                                                                              #
62 #                             All Fixed Variables                              #
65 # Constants
66 VERSION = 0.1.0-SNAPSHOT
67 OUTPREFIX = freeems
69 # Directories here
70 RELEASEDIR = ../firmware
71 DOXYDOCDIR = ../docs/doxygen-html
72 MAINDIR = freeems-vanilla
73 INCDIR = inc
74 BUGDIR = debug
75 OUTDIR = output
76 OBJDIR = objects
77 ASMDIR = assembly
78 S19DIR = firmware
79 PPCDIR = preprocessedc
81 # Release tag message file
82 RELTAG = $(OUTDIR)/gitTagMessage.txt
83 TAGNAME = $(OUTDIR)/gitTagName.txt
85 # Set the windows/non debian path first and then overwrite
86 # with the debian one so we can grep the deb line out and
87 # end up with a working windows make file in an automated
88 # way. Additionally, please ensure you do not add any sets
89 # of three . . . in a row or the line will be missing from
90 # the windows version. Likewise sets of ### longer than 6
91 # or so are also at risk :-)
92 PREFIX = m6811-elf-
93 PATHSEP = \\
95 # All of the tools
96 CP = cp
97 RM = rm -rf
98 MKDIR = mkdir
99 ZIP = zip
100 GCC = $(PREFIX)gcc
101 COPY = $(PREFIX)objcopy
102 DUMP = $(PREFIX)objdump
103 NM = $(PREFIX)nm
104 RE = $(PREFIX)readelf
105 SIZE = $(PREFIX)size
110 #                               All Source Files                               #
113 # Indirect dependencies - any header change means a full
114 # recompile. This can be improved upon and made more specific.
115 MAINH = main.h
116 INITH = init.h
117 UTILH = utils.h
118 MFILE = Makefile
119 ISRH = interrupts.h
120 CINCS = injectorISR.c
121 FLASHH = flashWrite.h
122 ASMH = 9S12XDP512asm.s
123 LOOKUPH = tableLookup.h
124 WMFILE = Makefile.windows
125 ISRSH = commsISRs.h injectionISRs.h
126 COMMSH = commsCore.h blockDetailsLookup.h
127 LINKER = memory.x regions.x hc9s12xdp512elfb.x
128 GLOBALH1 = freeEMS.h 9S12XDP512.h memory.h globalConstants.h structs.h
129 GLOBALH2 = globalDefines.h errorDefines.h TunableConfigs.h FixedConfigs.h
130 FUELH = fuelAndIgnitionCalcs.h derivedVarsGenerator.h coreVarsGenerator.h
131 RPMH = Simple.h NipponDenso.h LT1-360-8.h Subaru-36-2-2-2.h MissingTeeth.h MiataNB.h
133 # Let's keep this to a bare minimum! If you write ASM code
134 # please provide an matching alternate C implementation too.
135 HANDASMS = flashBurn.s
136 #RPMHANDASMS = 
138 # .c files from inc/ should be included here as deps for the parts they are relied on by!!
139 ALLHEADERS1 = $(GLOBALH1) $(COMMSH) $(ISRSH) $(UTILH) $(RPMH) $(FLASHH)
140 ALLHEADERS2 = $(GLOBALH2) $(FUELH) $(MAINH) $(INITH) $(ISRH) $(LOOKUPH)
141 ALLH1 = $(patsubst %.h,$(INCDIR)/%.h,$(ALLHEADERS1))
142 ALLH2 = $(patsubst %.h,$(INCDIR)/%.h,$(ALLHEADERS2))
143 ALLH3 = $(patsubst %.c,$(INCDIR)/%.c,$(CINCS))
144 ALLH4 = $(LINKER) $(MFILE) $(INCDIR)/$(ASMH)
145 ALLH = $(ALLH1) $(ALLH2) $(ALLH3) $(ALLH4)
147 # Warning : do not include .c files from inc/ as they are
148 # included into the other C files and automatically compiled.
150 # Flash data files
151 FIXEDCLASSES = FixedConfig1.c FixedConfig2.c
152 LOOKUPCLASSES1 = IATTransferTable.c CHTTransferTable.c
153 LOOKUPCLASSES2 = MAFTransferTable.c TestTransferTable.c
154 FUELCLASSES = FuelTables.c FuelTables2.c
155 TIMECLASSES = TimingTables.c TimingTables2.c
156 TUNECLASSES = TunableConfig.c TunableConfig2.c
158 # Source code files
159 UTILCLASSES = tableLookup.c init.c utils.c globalConstants.c
160 MATHCLASSES = coreVarsGenerator.c derivedVarsGenerator.c fuelAndIgnitionCalcs.c
161 COMCLASSES = flashWrite.c commsCore.c blockDetailsLookup.c
162 ISRCLASSES = interrupts.c injectionISRs.c ignitionISRs.c commsISRs.c realtimeISRs.c miscISRs.c
164 # All but the engine position/RPM combined here
165 SOURCE = freeEMS.c staticInit.c main.c $(UTILCLASSES) $(MATHCLASSES) $(COMCLASSES) $(ISRCLASSES)
166 DATA = $(FIXEDCLASSES) $(LOOKUPCLASSES1) $(LOOKUPCLASSES2) $(FUELCLASSES) $(TIMECLASSES) $(TUNECLASSES)
167 CLASSES = $(SOURCE) $(DATA)
169 # Engine position/RPM here
170 RPMCLASSES = Simple.c NipponDenso.c LT1-360-8.c Subaru-36-2-2-2.c MissingTeeth.c MiataNB.c
173 # Convert extensions
174 PREPROCESSED = $(patsubst %.c,$(PPCDIR)/%.pp.c,$(CLASSES))
175 ASSEMBLIES = $(patsubst %.c,$(ASMDIR)/%.s,$(CLASSES))
176 OBJECTS = $(patsubst %.c,$(OBJDIR)/%.o,$(CLASSES)) $(patsubst %.s,$(OBJDIR)/%.o,$(HANDASMS))
177 DUMPS = $(patsubst %.c,$(BUGDIR)/%.dmp,$(CLASSES)) $(patsubst %.s,$(BUGDIR)/%.dmp,$(HANDASMS))
179 # Convert RPM extensions
180 PREPROCESSEDRPM = $(patsubst %.c,$(PPCDIR)/%.pp.c,$(RPMCLASSES))
181 ASSEMBLIESRPM = $(patsubst %.c,$(ASMDIR)/%.s,$(RPMCLASSES))
182 OBJECTSRPM = $(patsubst %.c,$(OBJDIR)/%.o,$(RPMCLASSES)) #$(patsubst %.s,$(OBJDIR)/%.o,$(RPMHANDASMS))
183 DUMPSRPM = $(patsubst %.c,$(BUGDIR)/%.dmp,$(RPMCLASSES)) #$(patsubst %.s,$(BUGDIR)/%.dmp,$(RPMHANDASMS))
185 # Convert to output files
186 ALLELFSC = $(patsubst %.c,$(OUTDIR)/$(OUTPREFIX)-$(VERSION)-%.elf,$(RPMCLASSES))
187 ALLELFSASM = #$(patsubst %.s,$(OUTDIR)/$(OUTPREFIX)-$(VERSION)-%.elf,$(RPMHANDASMS))
188 ALLDMPSC = $(patsubst %.c,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.dmp,$(RPMCLASSES))
189 ALLDMPSASM = #$(patsubst %.s,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.dmp,$(RPMHANDASMS))
190 ALLMAPSC = $(patsubst %.c,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.map,$(RPMCLASSES))
191 ALLMAPSASM = #$(patsubst %.s,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.map,$(RPMHANDASMS))
192 ALLREADC = $(patsubst %.c,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.ree,$(RPMCLASSES))
193 ALLREADASM = #$(patsubst %.s,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.ree,$(RPMHANDASMS))
194 ALLS19SC = $(patsubst %.c,$(S19DIR)/$(OUTPREFIX)-$(VERSION)-%.s19,$(RPMCLASSES))
195 ALLS19SASM = #$(patsubst %.s,$(S19DIR)/$(OUTPREFIX)-$(VERSION)-%.s19,$(RPMHANDASMS))
196 ALLELFS = $(ALLELFSC) $(ALLELFSASM)
197 ALLDMPS = $(ALLDMPSC) $(ALLDMPSASM)
198 ALLMAPS = $(ALLMAPSC) $(ALLMAPSASM)
199 ALLREAD = $(ALLREADC) $(ALLREADASM)
200 ALLS19S = $(ALLS19SC) $(ALLS19SASM)
201 ALLMD5S = $(patsubst $(S19DIR)/%,$(RELEASEDIR)/%.md5,$(ALLS19S))
202 ALLSHA1S = $(patsubst $(S19DIR)/%,$(RELEASEDIR)/%.sha1,$(ALLS19S))
203 ALLS19ZIPS = $(patsubst $(S19DIR)/%,$(RELEASEDIR)/%.zip,$(ALLS19S))
205 # Convert to output files for GC variants
206 GCDELFSC = $(patsubst %.c,$(OUTDIR)/$(OUTPREFIX)-$(VERSION)-%.gc.elf,$(RPMCLASSES))
207 GCDELFSASM = #$(patsubst %.s,$(OUTDIR)/$(OUTPREFIX)-$(VERSION)-%.gc.elf,$(RPMHANDASMS))
208 GCDS19SC = $(patsubst %.c,$(S19DIR)/$(OUTPREFIX)-$(VERSION)-%.gc.s19,$(RPMCLASSES))
209 GCDS19SASM = #$(patsubst %.s,$(S19DIR)/$(OUTPREFIX)-$(VERSION)-%.gc.s19,$(RPMHANDASMS))
210 GCDELFS = $(GCDELFSC) $(GCDELFSASM)
211 GCDS19S = $(GCDS19SC) $(GCDELFSASM)
216 #                           All Command Line Options                           #
219 # M68hc1x GCC Options we may want : -minmax  -mlong-calls
221 # http://www.gnu.org/software/m68hc11/m68hc11_gcc.html shows code size with different options used
222 # include debug info, optimise , 16 bit ints, hcs12 platform
223 GCCOPTS1 = -g -Wall -Werror -Winline -O -m68hcs12 -mshort -ffunction-sections
224 GCCOPTS2 = -fomit-frame-pointer -msoft-reg-count=8 -mauto-incdec -fsigned-char
225 GCCOPTS = $(GCCOPTS1) $(GCCOPTS2)
226 # -ffunction-sections option splits out the functions such that the garbage collection can get
227 # them on a per section basis. I'm not sure, but this could be harmful to paged code so may
228 # have to review this at a later date perhaps splitting paged functions from nonpaged ones.
230 # pass to linker, link for hc12
231 # The vectors address in the linker options is the VMA address and must be short form 0xF710, not a paged address.
232 LINKOPTS = -Wl,-defsym,vectors_addr=0xF710,-m,m68hc12elfb,-T,hc9s12xdp512elfb.x
233 LINKOPTSGC = -Wl,--gc-sections,--print-gc-sections,-defsym,vectors_addr=0xF710,-m,m68hc12elfb,-T,hc9s12xdp512elfb.x
234 # Use this to get a map dump when the linker fails in a confusing way : --print-map
236 # If using the below option for paged flash, the ADDRESS_TYPE
237 # field in the freeEMSloader script should be updated to match.
238 COPYOPTS =  --output-target=srec \
239                 --change-section-lma .fixedconf1+0xFD4000 \
240                 --change-section-lma .fixedconf2+0xFD4000 \
241                      --change-section-lma .text1+0xFD4000 \
242                       --change-section-lma .text+0xFEC000 \
243                       --change-section-lma .data+0xFEC000 \
244                    --change-section-lma .vectors+0xFEC000 \
245                     --change-section-lma .rodata+0xFEC000 \
246                 --only-section=.fixedconf1 \
247                 --only-section=.fixedconf2 \
248                 --only-section=.text \
249                 --only-section=.text1 \
250                 --only-section=.data \
251                 --only-section=.vectors \
252                 --only-section=.rodata \
253                 --change-section-lma .ppageF8=0xF88000 \
254                 --change-section-lma .fpageF9=0xF98000 \
255                 --change-section-lma .dpageF9=0xF9A000 \
256                 --change-section-lma .ppageFE=0xFE8000 \
257                 --only-section=.ppageF8 \
258                 --only-section=.fpageF9 \
259                 --only-section=.dpageF9 \
260                 --only-section=.ppageFE \
261                 --change-section-lma .fpageFA=0xFA8000 \
262                 --change-section-lma .dpageFA=0xFAA000 \
263                 --change-section-lma .fpageFB=0xFB8000 \
264                 --change-section-lma .dpageFB1=0xFBA000 \
265                 --change-section-lma .dpageFB2=0xFBA400 \
266                 --change-section-lma .dpageFB3=0xFBA800 \
267                 --change-section-lma .dpageFB4=0xFBAC00 \
268                 --change-section-lma .dpageFB5=0xFBB000 \
269                 --change-section-lma .dpageFB6=0xFBB400 \
270                 --change-section-lma .dpageFB7=0xFBB800 \
271                 --change-section-lma .dpageFB8=0xFBBC00 \
272                 --change-section-lma .fpageFC=0xFC8000 \
273                 --change-section-lma .dpageFC=0xFCA000 \
274                 --only-section=.dpageFA \
275                 --only-section=.fpageFA \
276                 --only-section=.dpageFB1 \
277                 --only-section=.dpageFB2 \
278                 --only-section=.dpageFB3 \
279                 --only-section=.dpageFB4 \
280                 --only-section=.dpageFB5 \
281                 --only-section=.dpageFB6 \
282                 --only-section=.dpageFB7 \
283                 --only-section=.dpageFB8 \
284                 --only-section=.fpageFB \
285                 --only-section=.dpageFC \
286                 --only-section=.fpageFC
287 #               --change-section-lma .ppageFD=0xFD8000 \
288 #               --change-section-lma .ppageFF=0xFF8000 \
289 #               --only-section=.ppageFD \       This is left here for clarity only (equivalent to text1 but paged)
290 #               --only-section=.ppageFF         This is left here for clarity only (equivalent to text but paged)
291 # Changes to the above options should be reflected in memory.x and memory.h also!
293 # The following flash areas can only be used once Sean has written his loader app :
294 #               --only-section=.ppageE0 \
295 #               --only-section=.ppageE1 \
296 #               --only-section=.ppageE2 \
297 #               --only-section=.ppageE3 \
298 #               --only-section=.ppageE4 \
299 #               --only-section=.ppageE5 \
300 #               --only-section=.ppageE6 \
301 #               --only-section=.ppageE7 \
302 #               --only-section=.ppageE8 \
303 #               --only-section=.ppageE9 \
304 #               --only-section=.ppageEA \
305 #               --only-section=.ppageEB \
306 #               --only-section=.ppageEC \
307 #               --only-section=.ppageED \
308 #               --only-section=.ppageEE \
309 #               --only-section=.ppageEF \
310 #               --only-section=.ppageF0 \
311 #               --only-section=.ppageF1 \
312 #               --only-section=.ppageF2 \
313 #               --only-section=.ppageF3 \
314 #               --only-section=.ppageF4 \
315 #               --only-section=.ppageF5 \
316 #               --only-section=.ppageF6 \
317 #               --only-section=.ppageF7 \
318 #               --change-section-lma .ppageE0=0xE08000 \
319 #               --change-section-lma .ppageE1=0xE18000 \
320 #               --change-section-lma .ppageE2=0xE28000 \
321 #               --change-section-lma .ppageE3=0xE38000 \
322 #               --change-section-lma .ppageE4=0xE48000 \
323 #               --change-section-lma .ppageE5=0xE58000 \
324 #               --change-section-lma .ppageE6=0xE68000 \
325 #               --change-section-lma .ppageE7=0xE78000 \
326 #               --change-section-lma .ppageE8=0xE88000 \
327 #               --change-section-lma .ppageE9=0xE98000 \
328 #               --change-section-lma .ppageEA=0xEA8000 \
329 #               --change-section-lma .ppageEB=0xEB8000 \
330 #               --change-section-lma .ppageEC=0xEC8000 \
331 #               --change-section-lma .ppageED=0xED8000 \
332 #               --change-section-lma .ppageEE=0xEE8000 \
333 #               --change-section-lma .ppageEF=0xEF8000 \
334 #               --change-section-lma .ppageF0=0xF08000 \
335 #               --change-section-lma .ppageF1=0xF18000 \
336 #               --change-section-lma .ppageF2=0xF28000 \
337 #               --change-section-lma .ppageF3=0xF38000 \
338 #               --change-section-lma .ppageF4=0xF48000 \
339 #               --change-section-lma .ppageF5=0xF58000 \
340 #               --change-section-lma .ppageF6=0xF68000 \
341 #               --change-section-lma .ppageF7=0xF78000 \
345 help:
346         #                        Dependency And Target Summary                         #
347         #                                                                              #
348         #   Common targets:                                                            #
349         #                                                                              #
350         #       1) help - This comment block                                           #
351         #       2) all - Executes alldebug, slow, slowgc and size                      #
352         #       3) dirs - Creates all of the directories required to build             #
353         #       4) fast - Compiles direct to object code and links once with no debug  #
354         #       5) slow - Three stage compilation with assembly retained               #
355         #       6) slowgc - As above, but with garbage collection during linking       #
356         #       7) alldebug - Generates all debug output files                         #
357         #       8) install - Not yet implemented                                       #
358         #       9) release - Not yet implemented                                       #
359         #      10) clean - Removes all files and directories generated by building     #
360         #                                                                              #
361         #   Second level targets:                                                      #
362         #                                                                              #
363         #       Stage one:                                                             #
364         #                                                                              #
365         #           1) preprocess - run the C preprocessor over the raw C files        #
366         #           2) compile - compile the preprocessed C into assembly              #
367         #           3) assemble - assemble the assembly files into object files        #
368         #                                                                              #
369         #       Stage two                                                              #
370         #                                                                              #
371         #           1) link - Generate ELFs objects                                    #
372         #           2) gclink - As above, but with garbage collection                  #
373         #           3) s19 - Create s19s from elfs                                     #
374         #           4) gcs19 - Create s19s from gc elfs                                #
375         #                                                                              #
376         #       Stage three:                                                           #
377         #                                                                              #
378         #           1) maps - Memory map files                                         #
379         #           2) rees - Readelf dumps                                            #
380         #           3) elfdmps - Classic objdump output for final elfs                 #
381         #           4) objdmps - Classic objdump output for each object file           #
382         #                                                                              #
383         #   Additionally any of the output files can be used as a target directly.     #
384         #   This is perfect for building only what is required for a specific s19.     #
385         #   It is also perfect for working with a single file as you don't have to     #
386         #   wait for other unrelated things to build first nor do you have to wait     #
387         #   for other files to continue building after yours is successful. Before     #
388         #   using individual output files for targets, please run 'make dirs'.         #
389         #                                                                              #
394 #                           All Target Dependencies                            #
397 # Build everything the long way
398 all: alldebug gcs19 s19 size
399 # Single stage compilation
400 fast: single s19 size
401 # Multi stage compilation
402 slow: s19 size
403 # Multi stage compilation with garbage collection
404 # Clean all except release
405 clean: cleanasm cleanobj cleanout cleanppc cleans19 cleandebug
406 # Generate all debug
407 alldebug: maps rees elfdmps objdmps
408 # Load the s19 of your choice
409 #install: clean fast loader
410 # Perform a release
411 release: relprep relbuild relpack relperf
412 relprep: testgit clean cleanrelease cleandoxy
413 relbuild: md5sums md5sumsgc sha1sums sha1sumsgc s19zips s19zipsgc
414 relpack: zipdocs zipmain zipsite zipsrc
415 relperf: clean relcommit tagmessage tagrelease
420 #                           Debug Target Definitions                           #
423 mapsmsg:
425 maps: link $(BUGDIR) mapsmsg $(ALLMAPS)
427 $(ALLMAPS): $(BUGDIR)/%.map: $(OUTDIR)/%.elf
428         $(NM) $< | sort > $@
431 reesmsg:
433 rees: link $(BUGDIR) reesmsg $(ALLREAD)
435 $(ALLREAD): $(BUGDIR)/%.ree: $(OUTDIR)/%.elf
436         $(RE) -a -W $< > $@
439 elfdmpsmsg:
441 elfdmps: link $(BUGDIR) elfdmpsmsg $(ALLDMPS)
443 $(ALLDMPS): $(BUGDIR)/%.dmp: $(OUTDIR)/%.elf
444         $(DUMP) -spSd $< > $@
447 objdmpmsg:
449 objdmps: assemble $(BUGDIR) objdmpmsg $(DUMPS) $(DUMPSRPM)
451 $(DUMPS) $(DUMPSRPM): $(BUGDIR)/%.dmp: $(OBJDIR)/%.o
452         $(DUMP) -spSd $< > $@
457 #                 Fast Single Stage Compile Target Definition                  #
460 single:
465 #                       Link and Copy Target Definitions                       #
469 link: assemble $(OUTDIR) linkmsg $(ALLELFS)
471 # link the object files into an elf executable
472 $(ALLELFS): $(OUTDIR)/$(OUTPREFIX)-$(VERSION)-%.elf: $(OBJDIR)/%.o $(OBJECTS)
473         $(GCC) $(GCCOPTS) $(LINKOPTS) -o $@ $< $(OBJECTS)
481 s19: link $(S19DIR) s19msg $(ALLS19S)
482 # the gc dependency is temporary until i figure out if the .tramp removal is an issue or not.
484 # Generate the loadable s19 firmware files
485 $(ALLS19S): $(S19DIR)/%.s19: $(OUTDIR)/%.elf
486         $(COPY) $(COPYOPTS) $< $@
495 #                     Size Measuring Target Definition                         #
498 size: assemble # TODO this should be run for each s19 target with only the one rpm .o file
499         $(SIZE) $(OBJECTSRPM)
500         $(SIZE) -t $(OBJECTS)
501         #                    Add one decoder to the total above and                    #
502         #                   subtract the size reported for freeEMS.o                   #
503         #                   this will give you the actual image size                   #
504         #                                                                              #
505         #                  Thank you for building FreeEMS firmware!!!                  #
506         #                                                                              #
511 #              Preprocess, Compile and Assemble Target Definitions             #
515 preprocess: $(PPCDIR) preprocessmsg $(PREPROCESSED) $(PREPROCESSEDRPM)
517 # Generate preprocessed source files to examine
518 $(PREPROCESSED) $(PREPROCESSEDRPM): $(PPCDIR)/%.pp.c: %.c $(ALLH)
519         $(GCC) $(GCCOPTS) -E $< > $@
523 compile: preprocess compilemsg $(ASSEMBLIES) $(ASSEMBLIESRPM)
525 # Generate assembly files to examine
526 $(ASSEMBLIES) $(ASSEMBLIESRPM): $(ASMDIR)/%.s: $(PPCDIR)/%.pp.c
527         $(GCC) $(GCCOPTS) -x cpp-output -S -o $@ $<
531 assemble: compile $(OBJDIR) assemblemsg $(OBJECTS) $(OBJECTSRPM)
533 # Generate object files to link
534 $(OBJECTS) $(OBJECTSRPM): $(OBJDIR)/%.o: $(ASMDIR)/%.s
535         $(GCC) $(GCCOPTS) -c -o $@ $<
540 #                     Release Procedure Target Definitions                     #
543 testgit:
544         #check git status for changes, fail build if not fully commited
547 ALLMD5S = $(patsubst $(S19DIR)/%,$(RELEASEDIR)/%.md5,$(ALLS19S))
549 md5sumsmsg:
551 md5sums: s19 md5sumsmsg $(ALLMD5S)
553 $(ALLMD5S): $(RELEASEDIR)/%.s19.md5: $(S19DIR)/%.s19
554         md5sum $< > $@
557 sha1sumsmsg:
559 sha1sums: s19 sha1sumsmsg $(ALLSHA1S)
561 $(ALLSHA1S): $(RELEASEDIR)/%.s19.sha1: $(S19DIR)/%.s19
562         sha1sum $< > $@
565 s19zipsmsg:
567 s19zips: s19 s19zipsmsg $(ALLS19ZIPS)
569 $(ALLS19ZIPS): $(RELEASEDIR)/%.s19.zip: $(S19DIR)/%.s19
570         zip $@ $<
573 relcommit:
574         git commit -m "Automatically committing release files for FreeEMS version $(VERSION)!" $(RELEASEDIR)/
577 tagmessage:
578         vim $(RELTAG)
580 tagname:
581         vim $(TAGNAME)
583 tagrelease: tagname tagmessage
584         git tag -F $(RELTAG) `cat $(TGANAME)` HEAD
586 .PHONY: cleandoxy
587 cleandoxy:
588         #remove doxy dir
590 .PHONY: zipmain
591 zipmain:
592         #zip entire directory to parent
594 .PHONY: zipdocs
595 zipdocs:
596         #zip docs to parent
598 .PHONY: gendoxy
599 gendoxy:
600         #doxygen -f Doxyfile ouput file option | grep Warning
602 .PHONY: zipsite
603 zipsite:
604         #zip doxygen to parent
606 .PHONY: zipsource
607 zipsrc:
608         #zip just src to parent
610 #EXCLUDES = --exclude=$${OLDPWD}/../.git --exclude=$${OLDPWD}/../docs --exclude=$${OLDPWD}/../src/$(OBJDIR) --exclude=$${OLDPWD}/../src/$(PPCDIR) --exclude=$${OLDPWD}/../src/$(OUTDIR) --exclude=$${OLDPWD}/../src/$(BUGDIR) --exclude=$${OLDPWD}/../src/$(S19DIR) --exclude=$${OLDPWD}/$(DOXYDOCDIR) --exclude=$${OLDPWD}/$(RELEASEDIR)
611 EXCLUDES = --exclude=${MAINDIR}/.git --exclude=${MAINDIR}/docs --exclude=${MAINDIR}/src/$(OBJDIR) --exclude=${MAINDIR}/src/$(PPCDIR) --exclude=${MAINDIR}/src/$(OUTDIR) --exclude=${MAINDIR}/src/$(BUGDIR) --exclude=${MAINDIR}/src/$(S19DIR) --exclude=${MAINDIR}/$(S19DIR) --exclude=${MAINDIR}/src/$(DOXYDOCDIR)
613 #archive:
614 #       cd ../../;tar --show-omitted-dirs ${EXCLUDES} -cjf freeems-${VERSION}-`date +%s`.tar.bz2 $${OLDPWD}/../;cd -
616 archive:
617         tar -C ../../ ${EXCLUDES} -cjf ../../freeems-${VERSION}-`date +%s`.tar.bz2 ${MAINDIR}
621 #                     Create Directory Target Definitions                      #
623 # Assembly, release and inc directories don't get removed.
625 dirs: $(BUGDIR) $(S19DIR) $(PPCDIR) $(OUTDIR) $(OBJDIR)
627 $(BUGDIR):
628         $(MKDIR) $(BUGDIR)$(PATHSEP)hack
629         rmdir $(BUGDIR)$(PATHSEP)hack
631 $(S19DIR):
632         $(MKDIR) $(S19DIR)$(PATHSEP)hack
633         rmdir $(S19DIR)$(PATHSEP)hack
635 $(PPCDIR):
636         $(MKDIR) $(PPCDIR)$(PATHSEP)hack
637         rmdir $(PPCDIR)$(PATHSEP)hack
639 $(OUTDIR):
640         $(MKDIR) $(OUTDIR)$(PATHSEP)hack
641         rmdir $(OUTDIR)$(PATHSEP)hack
643 $(OBJDIR):
644         $(MKDIR) $(OBJDIR)$(PATHSEP)hack
645         rmdir $(OBJDIR)$(PATHSEP)hack
650 #                            Clean Target Definitions                          #
652 cleanasm:
653         $(RM) $(ASSEMBLIES) $(ASSEMBLIESRPM)
655 cleanppc:
656         $(RM) $(PPCDIR)
658 cleanobj:
659         $(RM) $(OBJDIR)
661 cleanout:
662         $(RM) $(OUTDIR)
664 cleans19:
665         $(RM) $(S19DIR)
667 cleandebug:
668         $(RM) $(BUGDIR)
670 cleanrelease:
671         $(RM) $(RELEASEDIR)/*.zip
672         $(RM) $(RELEASEDIR)/*.md5
673         $(RM) $(RELEASEDIR)/*.sha1
678 #                   Declare targets that aren't real files                     #
681 # Aggregators top level
682 .PHONY: all fast slow slowgc single help dirs
684 # Aggregators middle level
685 .PHONY: preprocess compile assemble link gclink s19 gcs19
687 # Aggregators debug level
688 .PHONY: alldebug maps rees objdmps elfdmps size
690 # Release targets
691 .PHONY: release relprep relperf relbuild relpack
692 .PHONY: md5sums sha1sums s19zips sha1sumsgc s19zips s19zipsgc
693 .PHONY: testgit relcommit tagname tagmessage tagrelease
695 # Messages
696 .PHONY: mapsmsg reesmsg elfdmpsmsg objdmpmsg linkmsg gclinkmsg
697 .PHONY: s19msg gcs19msg preprocessmsg compilemsg assemblemsg
698 .PHONY: md5sumsmsg sha1sumsmsg s19zipsmsg
700 # Clean targets
701 .PHONY: clean cleanasm cleanppc cleanobj cleanout cleans19 cleandebug cleanrelease