1 # FreeEMS - the open source engine management system
3 # Copyright 2008, 2009 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 ################################################################################
28 # This Makefile is designed to be run with GNU make! Accept no substitute! #
30 ################################################################################
32 # Top level targets: #
35 # Builds all output files in the slow multi stage way with all debugging #
37 # Compiles from C straight to objects, links to elfs and copies to s19s #
39 # Permanently removes all build artifact files and directories #
41 # Cleans the project, builds it from scratch, copies the s19 files up to #
42 # the firmware directory, zips each s19 separately, zips all of the #
43 # documentation, cleans the project again and lastly zips the entire #
46 ################################################################################
48 # When doing a full build the following steps are taken: #
50 # 1) Pre-process all of the C files #
51 # 2) Compile all preprocessed C files into assembly files #
52 # 3) Assemble all assembly files into object files #
53 # 4) Dump the contents of all object files #
54 # 5) Link one decoder with garbage collection and reporting turned on #
55 # 6) Link each decoder without garbage collection #
56 # 7) Dump the contents of each decoders elf #
57 # 8) Produce a memory map for each elf #
58 # 9) Produce a readelf dump for each elf #
59 # 10) Produce an s19 loadable firmware file for each elf #
61 ################################################################################
66 ################################################################################
67 # All Fixed Variables #
68 ################################################################################
76 RELEASEDIR
= ..
/firmware
83 PPCDIR
= preprocessedc
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 :-)
101 MKDIR
= mkdir
-p
#...
104 COPY
= $(PREFIX
)objcopy
105 DUMP
= $(PREFIX
)objdump
107 RE
= $(PREFIX
)readelf
113 ################################################################################
115 ################################################################################
118 # Indirect dependencies - any header change means a full
119 # recompile. This can be improved upon and made more specific.
125 CINCS
= injectorISR.c
126 FLASHH
= flashWrite.h
127 ASMH
= 9S12XDP512asm.s
128 LOOKUPH
= tableLookup.h
129 WMFILE
= Makefile.windows
130 ISRSH
= commsISRs.h injectionISRs.h
131 COMMSH
= commsCore.h blockDetailsLookup.h
132 LINKER
= memory.x regions.x hc9s12xdp512elfb.x
133 GLOBALH1
= freeEMS.h
9S12XDP512.h memory.h globalConstants.h structs.h
134 GLOBALH2
= globalDefines.h errorDefines.h TunableConfigs.h FixedConfigs.h
135 FUELH
= fuelAndIgnitionCalcs.h derivedVarsGenerator.h coreVarsGenerator.h
136 RPMH
= NipponDenso.h LT1-360-8.h Subaru-36-2-2-2.h MissingTeeth.h MiataNB.h
138 # Let's keep this to a bare minimum! If you write ASM code
139 # please provide an matching alternate C implementation too.
140 HANDASMS
= flashBurn.s
143 # .c files from inc/ should be included here as deps for the parts they are relied on by!!
144 ALLHEADERS1
= $(GLOBALH1
) $(COMMSH
) $(ISRSH
) $(UTILH
) $(RPMH
) $(FLASHH
)
145 ALLHEADERS2
= $(GLOBALH2
) $(FUELH
) $(MAINH
) $(INITH
) $(ISRH
) $(LOOKUPH
)
146 ALLH1
= $(patsubst %.h
,$(INCDIR
)/%.h
,$(ALLHEADERS1
))
147 ALLH2
= $(patsubst %.h
,$(INCDIR
)/%.h
,$(ALLHEADERS2
))
148 ALLH3
= $(patsubst %.c
,$(INCDIR
)/%.c
,$(CINCS
))
149 ALLH4
= $(LINKER
) $(MFILE
) $(INCDIR
)/$(ASMH
)
150 ALLH
= $(ALLH1
) $(ALLH2
) $(ALLH3
) $(ALLH4
)
152 # Warning : do not include .c files from inc/ as they are
153 # included into the other C files and automatically compiled.
156 FIXEDCLASSES
= FixedConfig1.c FixedConfig2.c
157 LOOKUPCLASSES1
= IATTransferTable.c CHTTransferTable.c
158 LOOKUPCLASSES2
= MAFTransferTable.c TestTransferTable.c
159 FUELCLASSES
= FuelTables.c FuelTables2.c
160 TIMECLASSES
= TimingTables.c TimingTables2.c
161 TUNECLASSES
= TunableConfig.c TunableConfig2.c
164 UTILCLASSES
= tableLookup.c init.c utils.c globalConstants.c
165 MATHCLASSES
= coreVarsGenerator.c derivedVarsGenerator.c fuelAndIgnitionCalcs.c
166 COMCLASSES
= flashWrite.c commsCore.c blockDetailsLookup.c
167 ISRCLASSES
= interrupts.c injectionISRs.c ignitionISRs.c commsISRs.c realtimeISRs.c miscISRs.c
169 # All but the engine position/RPM combined here
170 SOURCE
= freeEMS.c staticInit.c main.c
$(UTILCLASSES
) $(MATHCLASSES
) $(COMCLASSES
) $(ISRCLASSES
)
171 DATA
= $(FIXEDCLASSES
) $(LOOKUPCLASSES1
) $(LOOKUPCLASSES2
) $(FUELCLASSES
) $(TIMECLASSES
) $(TUNECLASSES
)
172 CLASSES
= $(SOURCE
) $(DATA
)
174 # Engine position/RPM here
175 RPMCLASSES
= NipponDenso.c LT1-360-8.c Subaru-36-2-2-2.c MissingTeeth.c MiataNB.c
176 # future rpm = NissanRB2X.c NissanSR20.c MiataNA.c etc... Insert your file above and get coding!
180 PREPROCESSED
= $(patsubst %.c
,$(PPCDIR
)/%.pp.c
,$(CLASSES
))
181 ASSEMBLIES
= $(patsubst %.c
,$(ASMDIR
)/%.s
,$(CLASSES
))
182 OBJECTS
= $(patsubst %.c
,$(OBJDIR
)/%.o
,$(CLASSES
)) $(patsubst %.s
,$(OBJDIR
)/%.o
,$(HANDASMS
))
183 DUMPS
= $(patsubst %.c
,$(BUGDIR
)/%.dmp
,$(CLASSES
)) $(patsubst %.s
,$(BUGDIR
)/%.dmp
,$(HANDASMS
))
185 # Convert RPM extensions
186 PREPROCESSEDRPM
= $(patsubst %.c
,$(PPCDIR
)/%.pp.c
,$(RPMCLASSES
))
187 ASSEMBLIESRPM
= $(patsubst %.c
,$(ASMDIR
)/%.s
,$(RPMCLASSES
))
188 OBJECTSRPM
= $(patsubst %.c
,$(OBJDIR
)/%.o
,$(RPMCLASSES
)) #$(patsubst %.s,$(OBJDIR)/%.o,$(RPMHANDASMS))
189 DUMPSRPM
= $(patsubst %.c
,$(BUGDIR
)/%.dmp
,$(RPMCLASSES
)) #$(patsubst %.s,$(BUGDIR)/%.dmp,$(RPMHANDASMS))
191 # Convert to output files
192 ALLELFSC
= $(patsubst %.c
,$(OUTDIR
)/$(OUTPREFIX
)-$(VERSION
)-%.elf
,$(RPMCLASSES
))
193 ALLELFSASM
= #$(patsubst %.s,$(OUTDIR)/$(OUTPREFIX)-$(VERSION)-%.elf,$(RPMHANDASMS))
194 ALLDMPSC
= $(patsubst %.c
,$(BUGDIR
)/$(OUTPREFIX
)-$(VERSION
)-%.dmp
,$(RPMCLASSES
))
195 ALLDMPSASM
= #$(patsubst %.s,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.dmp,$(RPMHANDASMS))
196 ALLMAPSC
= $(patsubst %.c
,$(BUGDIR
)/$(OUTPREFIX
)-$(VERSION
)-%.map
,$(RPMCLASSES
))
197 ALLMAPSASM
= #$(patsubst %.s,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.map,$(RPMHANDASMS))
198 ALLREADC
= $(patsubst %.c
,$(BUGDIR
)/$(OUTPREFIX
)-$(VERSION
)-%.ree
,$(RPMCLASSES
))
199 ALLREADASM
= #$(patsubst %.s,$(BUGDIR)/$(OUTPREFIX)-$(VERSION)-%.ree,$(RPMHANDASMS))
200 ALLS19SC
= $(patsubst %.c
,$(S19DIR
)/$(OUTPREFIX
)-$(VERSION
)-%.s19
,$(RPMCLASSES
))
201 ALLS19SASM
= #$(patsubst %.s,$(S19DIR)/$(OUTPREFIX)-$(VERSION)-%.s19,$(RPMHANDASMS))
202 ALLELFS
= $(ALLELFSC
) $(ALLELFSASM
)
203 ALLDMPS
= $(ALLDMPSC
) $(ALLDMPSASM
)
204 ALLMAPS
= $(ALLMAPSC
) $(ALLMAPSASM
)
205 ALLREAD
= $(ALLREADC
) $(ALLREADASM
)
206 ALLS19S
= $(ALLS19SC
) $(ALLS19SASM
)
208 # Convert to output files for GC variants
209 GCDELFSC
= $(patsubst %.c
,$(OUTDIR
)/$(OUTPREFIX
)-$(VERSION
)-%.gc.elf
,$(RPMCLASSES
))
210 GCDELFSASM
= #$(patsubst %.s,$(OUTDIR)/$(OUTPREFIX)-$(VERSION)-%.gc.elf,$(RPMHANDASMS))
211 GCDS19SC
= $(patsubst %.c
,$(S19DIR
)/$(OUTPREFIX
)-$(VERSION
)-%.gc.s19
,$(RPMCLASSES
))
212 GCDS19SASM
= #$(patsubst %.s,$(S19DIR)/$(OUTPREFIX)-$(VERSION)-%.gc.s19,$(RPMHANDASMS))
213 GCDELFS
= $(GCDELFSC
) $(GCDELFSASM
)
214 GCDS19S
= $(GCDS19SC
) $(GCDELFSASM
)
219 ################################################################################
220 # All Command Line Options #
221 ################################################################################
224 # M68hc1x GCC Options we may want : -minmax -mlong-calls
226 # http://www.gnu.org/software/m68hc11/m68hc11_gcc.html shows code size with different options used
227 # include debug info, optimise , 16 bit ints, hcs12 platform
228 GCCOPTS1
= -g
-Wall
-Werror
-Winline
-O
-m68hcs12
-mshort
-ffunction-sections
229 GCCOPTS2
= -fomit-frame-pointer
-msoft-reg-count
=8 -mauto-incdec
-fsigned-char
230 GCCOPTS
= $(GCCOPTS1
) $(GCCOPTS2
)
231 # -ffunction-sections option splits out the functions such that the garbage collection can get
232 # them on a per section basis. I'm not sure, but this could be harmful to paged code so may
233 # have to review this at a later date perhaps splitting paged functions from nonpaged ones.
235 # pass to linker, link for hc12
236 # The vectors address in the linker options is the VMA address and must be short form 0xF710, not a paged address.
237 LINKOPTS
= -Wl
,-defsym
,vectors_addr
=0xF710,-m
,m68hc12elfb
,-T
,hc9s12xdp512elfb.x
238 LINKOPTSGC
= -Wl
,--gc-sections
,--print-gc-sections
,-defsym
,vectors_addr
=0xF710,-m
,m68hc12elfb
,-T
,hc9s12xdp512elfb.x
239 # Use this to get a map dump when the linker fails in a confusing way : --print-map
241 # If using the below option for paged flash, the ADDRESS_TYPE
242 # field in the freeEMSloader script should be updated to match.
243 COPYOPTS
= --output-target
=srec \
244 --change-section-lma .fixedconf1
+0xFD4000 \
245 --change-section-lma .fixedconf2
+0xFD4000 \
246 --change-section-lma .text1
+0xFD4000 \
247 --change-section-lma .text
+0xFEC000 \
248 --change-section-lma .data
+0xFEC000 \
249 --change-section-lma .vectors
+0xFEC000 \
250 --change-section-lma .rodata
+0xFEC000 \
251 --only-section
=.fixedconf1 \
252 --only-section
=.fixedconf2 \
253 --only-section
=.text \
254 --only-section
=.text1 \
255 --only-section
=.data \
256 --only-section
=.vectors \
257 --only-section
=.rodata \
258 --change-section-lma .ppageF8
=0xF88000 \
259 --change-section-lma .fpageF9
=0xF98000 \
260 --change-section-lma .dpageF9
=0xF9A000 \
261 --change-section-lma .ppageFE
=0xFE8000 \
262 --only-section
=.ppageF8 \
263 --only-section
=.fpageF9 \
264 --only-section
=.dpageF9 \
265 --only-section
=.ppageFE \
266 --change-section-lma .fpageFA
=0xFA8000 \
267 --change-section-lma .dpageFA
=0xFAA000 \
268 --change-section-lma .fpageFB
=0xFB8000 \
269 --change-section-lma .dpageFB1
=0xFBA000 \
270 --change-section-lma .dpageFB2
=0xFBA400 \
271 --change-section-lma .dpageFB3
=0xFBA800 \
272 --change-section-lma .dpageFB4
=0xFBAC00 \
273 --change-section-lma .dpageFB5
=0xFBB000 \
274 --change-section-lma .dpageFB6
=0xFBB400 \
275 --change-section-lma .dpageFB7
=0xFBB800 \
276 --change-section-lma .dpageFB8
=0xFBBC00 \
277 --change-section-lma .fpageFC
=0xFC8000 \
278 --change-section-lma .dpageFC
=0xFCA000 \
279 --only-section
=.dpageFA \
280 --only-section
=.fpageFA \
281 --only-section
=.dpageFB1 \
282 --only-section
=.dpageFB2 \
283 --only-section
=.dpageFB3 \
284 --only-section
=.dpageFB4 \
285 --only-section
=.dpageFB5 \
286 --only-section
=.dpageFB6 \
287 --only-section
=.dpageFB7 \
288 --only-section
=.dpageFB8 \
289 --only-section
=.fpageFB \
290 --only-section
=.dpageFC \
291 --only-section
=.fpageFC
292 # --change-section-lma .ppageFD=0xFD8000 \
293 # --change-section-lma .ppageFF=0xFF8000 \
294 # --only-section=.ppageFD \ This is left here for clarity only (equivalent to text1 but paged)
295 # --only-section=.ppageFF This is left here for clarity only (equivalent to text but paged)
296 # Changes to the above options should be reflected in memory.x and memory.h also!
298 # The following flash areas can only be used once Sean has written his loader app :
299 # --only-section=.ppageE0 \
300 # --only-section=.ppageE1 \
301 # --only-section=.ppageE2 \
302 # --only-section=.ppageE3 \
303 # --only-section=.ppageE4 \
304 # --only-section=.ppageE5 \
305 # --only-section=.ppageE6 \
306 # --only-section=.ppageE7 \
307 # --only-section=.ppageE8 \
308 # --only-section=.ppageE9 \
309 # --only-section=.ppageEA \
310 # --only-section=.ppageEB \
311 # --only-section=.ppageEC \
312 # --only-section=.ppageED \
313 # --only-section=.ppageEE \
314 # --only-section=.ppageEF \
315 # --only-section=.ppageF0 \
316 # --only-section=.ppageF1 \
317 # --only-section=.ppageF2 \
318 # --only-section=.ppageF3 \
319 # --only-section=.ppageF4 \
320 # --only-section=.ppageF5 \
321 # --only-section=.ppageF6 \
322 # --only-section=.ppageF7 \
323 # --change-section-lma .ppageE0=0xE08000 \
324 # --change-section-lma .ppageE1=0xE18000 \
325 # --change-section-lma .ppageE2=0xE28000 \
326 # --change-section-lma .ppageE3=0xE38000 \
327 # --change-section-lma .ppageE4=0xE48000 \
328 # --change-section-lma .ppageE5=0xE58000 \
329 # --change-section-lma .ppageE6=0xE68000 \
330 # --change-section-lma .ppageE7=0xE78000 \
331 # --change-section-lma .ppageE8=0xE88000 \
332 # --change-section-lma .ppageE9=0xE98000 \
333 # --change-section-lma .ppageEA=0xEA8000 \
334 # --change-section-lma .ppageEB=0xEB8000 \
335 # --change-section-lma .ppageEC=0xEC8000 \
336 # --change-section-lma .ppageED=0xED8000 \
337 # --change-section-lma .ppageEE=0xEE8000 \
338 # --change-section-lma .ppageEF=0xEF8000 \
339 # --change-section-lma .ppageF0=0xF08000 \
340 # --change-section-lma .ppageF1=0xF18000 \
341 # --change-section-lma .ppageF2=0xF28000 \
342 # --change-section-lma .ppageF3=0xF38000 \
343 # --change-section-lma .ppageF4=0xF48000 \
344 # --change-section-lma .ppageF5=0xF58000 \
345 # --change-section-lma .ppageF6=0xF68000 \
346 # --change-section-lma .ppageF7=0xF78000 \
351 ################################################################################
352 # Dependency And Target Summary #
353 ################################################################################
357 # 1) help - This comment block #
358 # 2) all - Executes alldebug, slow, slowgc and size #
359 # 3) fast - Compiles direct to object code and links once with no debug #
360 # 4) slow - Three stage compilation with assembly retained #
361 # 5) slowgc - As above, but with garbage collection during linking #
362 # 6) alldebug - Generates all debug output files #
363 # 7) install - Not yet implemented #
364 # 8) release - Not yet implemented #
365 # 9) clean - Removes all files and directories generated by building #
367 # Second level targets: #
371 # 1) preprocess - run the C preprocessor over the raw C files #
372 # 2) compile - compile the preprocessed C into assembly #
373 # 3) assemble - assemble the assembly files into object files #
377 # 1) link - Generate ELFs objects #
378 # 2) gclink - As above, but with garbage collection #
379 # 3) s19 - Create s19s from elfs #
380 # 4) gcs19 - Create s19s from gc elfs #
384 # 1) maps - Memory map files #
385 # 2) rees - Readelf dumps #
386 # 3) elfdmps - Classic objdump output for final elfs #
387 # 4) objdmps - Classic objdump output for each object file #
389 ################################################################################
394 ################################################################################
395 # All Target Dependencies #
396 ################################################################################
399 # Build everything the long way
400 all: alldebug gcs19 s19 size
401 # Single stage compilation
402 fast
: single s19 size
403 # Multi stage compilation
405 # Multi stage compilation with garbage collection
406 slowgc
: gcs19 size
#...
407 # Clean all except release
408 clean: cleanasm cleanobj cleanout cleanppc cleans19 cleandebug
410 alldebug
: maps rees elfdmps objdmps
411 # Load the s19 of your choice
412 #install: clean fast loader
414 #release: clean cleanrelease fast someMoreStuffHere checksums zipping etc
419 ################################################################################
420 # Debug Target Definitions #
421 ################################################################################
425 ################################################################################
426 # Generating memory maps.... #
427 ################################################################################
429 maps
: link
$(BUGDIR
) mapsmsg
$(ALLMAPS
)
431 $(ALLMAPS
): $(BUGDIR
)/%.map
: $(OUTDIR
)/%.elf
436 ################################################################################
437 # Reading all elf files... #
438 ################################################################################
440 rees
: link
$(BUGDIR
) reesmsg
$(ALLREAD
)
442 $(ALLREAD
): $(BUGDIR
)/%.ree
: $(OUTDIR
)/%.elf
447 ################################################################################
448 # Dumping all elf files... #
449 ################################################################################
451 elfdmps
: link
$(BUGDIR
) elfdmpsmsg
$(ALLDMPS
)
453 $(ALLDMPS
): $(BUGDIR
)/%.dmp
: $(OUTDIR
)/%.elf
454 $(DUMP
) -spSd
$< > $@
458 ################################################################################
459 # Dumping all object files.... #
460 ################################################################################
462 objdmps
: assemble
$(BUGDIR
) objdmpmsg
$(DUMPS
) $(DUMPSRPM
)
464 $(DUMPS
) $(DUMPSRPM
): $(BUGDIR
)/%.dmp
: $(OBJDIR
)/%.o
465 $(DUMP
) -spSd
$< > $@
470 ################################################################################
471 # Fast Single Stage Compile Target Definition #
472 ################################################################################
476 # TODO fast compile and figure out overlapping dependencies...
481 ################################################################################
482 # Link and Copy Target Definitions #
483 ################################################################################
487 ################################################################################
488 # Linking the Objects into an ELF... #
489 ################################################################################
491 link
: assemble
$(OUTDIR
) linkmsg
$(ALLELFS
)
493 # link the object files into an elf executable
494 $(ALLELFS
): $(OUTDIR
)/$(OUTPREFIX
)-$(VERSION
)-%.elf
: $(OBJDIR
)/%.o
$(OBJECTS
)
495 ################################################################################
497 ################################################################################
498 $(GCC
) $(GCCOPTS
) $(LINKOPTS
) -o
$@
$< $(OBJECTS
)
502 ################################################################################
503 # Linking the Objects into an ELF... #
504 ################################################################################
506 gclink
: assemble
$(OUTDIR
) linkmsg
$(GCDELFS
) #...
508 # link the object files into an elf executable with gc...
509 $(GCDELFS
): $(OUTDIR
)/$(OUTPREFIX
)-$(VERSION
)-%.gc.elf
: $(OBJDIR
)/%.o
$(OBJECTS
) #...
510 ################################################################################
512 ################################################################################
513 $(GCC
) $(GCCOPTS
) $(LINKOPTSGC
) -o
$@
$< $(OBJECTS
) # ...
514 # The links with garbage collection are to ensure that there are no warnings ...
515 # TODO find out how to stop .tramp from being collected (or inserted)! ...
519 ################################################################################
520 # Building The S19 Files.... #
521 ################################################################################
523 s19
: link
$(S19DIR
) s19msg
$(ALLS19S
)
524 # the gc dependency is temporary until i figure out if the .tramp removal is an issue or not.
526 # Generate the loadable s19 firmware files
527 $(ALLS19S
): $(S19DIR
)/%.s19
: $(OUTDIR
)/%.elf
528 ################################################################################
530 ################################################################################
531 $(COPY
) $(COPYOPTS
) $< $@
532 ################################################################################
534 ################################################################################
535 echo
"Flash image size of $@ is" `echo \`cat
$@ | wc
-l\
` "* 16" | bc -l` "bytes..."
539 ################################################################################
540 # Building The S19 Files.... #
541 ################################################################################
543 gcs19
: gclink
$(S19DIR
) gcs19msg
$(GCDS19S
) #...
545 # Generate the garbage collected s19 files temporarily...
546 $(GCDS19S
): $(S19DIR
)/%.s19
: $(OUTDIR
)/%.elf
#...
547 ################################################################################
549 ################################################################################
550 $(COPY
) $(COPYOPTS
) $< $@
#...
551 ################################################################################
553 ################################################################################
554 echo
"Flash image size of $@ is" `echo \`cat
$@ | wc
-l\
` "* 16" | bc -l` "bytes..."
559 ################################################################################
560 # Size Measuring Target Definition #
561 ################################################################################
564 size
: # TODO this should be run for each s19 target with only the one rpm .o file
565 ################################################################################
566 # Measuring The Decoder Binaries... #
567 ################################################################################
568 $(SIZE
) $(OBJECTSRPM
)
569 ################################################################################
570 # Measuring All Other Binaries... #
571 ################################################################################
572 $(SIZE
) -t
$(OBJECTS
)
573 ################################################################################
574 # Add one decoder to the total above and #
575 # subtract the size reported for freeEMS.o #
576 # this will give you the actual image size #
577 ################################################################################
579 # Thank you for building FreeEMS firmware!!! #
581 ################################################################################
586 ################################################################################
587 # Preprocess, Compile and Assemble Target Definitions #
588 ################################################################################
592 ################################################################################
593 # Running the C Pre Processor... #
594 ################################################################################
596 preprocess
: $(PPCDIR
) preprocessmsg
$(PREPROCESSED
) $(PREPROCESSEDRPM
)
598 # Generate preprocessed source files to examine
599 $(PREPROCESSED
) $(PREPROCESSEDRPM
): $(PPCDIR
)/%.pp.c
: %.c
$(ALLH
)
600 $(GCC
) $(GCCOPTS
) -E
$< > $@
604 ################################################################################
605 # Compiling PPC to Assembly... #
606 ################################################################################
608 compile
: preprocess compilemsg
$(ASSEMBLIES
) $(ASSEMBLIESRPM
)
610 # Generate assembly files to examine
611 $(ASSEMBLIES
) $(ASSEMBLIESRPM
): $(ASMDIR
)/%.s
: $(PPCDIR
)/%.pp.c
612 $(GCC
) $(GCCOPTS
) -x cpp-output
-S
-o
$@
$<
616 ################################################################################
617 # Assembling Object Files... #
618 ################################################################################
620 assemble
: compile
$(OBJDIR
) assemblemsg
$(OBJECTS
) $(OBJECTSRPM
)
622 # Generate object files to link
623 $(OBJECTS
) $(OBJECTSRPM
): $(OBJDIR
)/%.o
: $(ASMDIR
)/%.s
624 $(GCC
) $(GCCOPTS
) -c
-o
$@
$<
629 ################################################################################
630 # Release Procedure Target Definitions #
631 ################################################################################
635 #check git status for changes, fail build if not fully commited
641 #md5sum/sha1sum s19s above
647 #zip each s19 to parent
651 #zip without docs to parent
653 #zip entire directory to parent
658 ################################################################################
659 # Create Directory Target Definitions #
660 ################################################################################
662 # Assembly, release and inc directories don't get removed.
665 ################################################################################
666 # Creating the debug directory.... #
667 ################################################################################
668 $(MKDIR
) $(BUGDIR
)$(PATHSEP
)hack
669 rmdir
$(BUGDIR
)$(PATHSEP
)hack
672 ################################################################################
673 # Creating the firmware directory... #
674 ################################################################################
675 $(MKDIR
) $(S19DIR
)$(PATHSEP
)hack
676 rmdir
$(S19DIR
)$(PATHSEP
)hack
679 ################################################################################
680 # Creating the preprocessedc directory.... #
681 ################################################################################
682 $(MKDIR
) $(PPCDIR
)$(PATHSEP
)hack
683 rmdir
$(PPCDIR
)$(PATHSEP
)hack
686 ################################################################################
687 # Creating the output directory... #
688 ################################################################################
689 $(MKDIR
) $(OUTDIR
)$(PATHSEP
)hack
690 rmdir
$(OUTDIR
)$(PATHSEP
)hack
693 ################################################################################
694 # Creating the object directory... #
695 ################################################################################
696 $(MKDIR
) $(OBJDIR
)$(PATHSEP
)hack
697 rmdir
$(OBJDIR
)$(PATHSEP
)hack
702 ################################################################################
703 # Clean Target Definitions #
704 ################################################################################
707 ################################################################################
708 # Removing generated assembly files.... #
709 ################################################################################
710 $(RM
) $(ASSEMBLIES
) $(ASSEMBLIESRPM
)
713 ################################################################################
714 # Removing pre-processed C output directory... #
715 ################################################################################
719 ################################################################################
720 # Removing object directory... #
721 ################################################################################
725 ################################################################################
726 # Removing link output directory... #
727 ################################################################################
731 ################################################################################
732 # Removing s19 directory... #
733 ################################################################################
737 ################################################################################
738 # Removing debug directory... #
739 ################################################################################
743 ################################################################################
744 # Removing all release files... #
745 ################################################################################
746 $(RM
) $(RELEASEDIR
)/*.zip
747 $(RM
) $(RELEASEDIR
)/*.s19
748 $(RM
) $(RELEASEDIR
)/*.md5
749 $(RM
) $(RELEASEDIR
)/*.sha1
754 ################################################################################
755 # Declare targets that aren't real files #
756 ################################################################################
759 # Aggregators top level
760 .PHONY
: all fast slow slowgc single help
762 # Aggregators middle level
763 .PHONY
: preprocess compile assemble link gclink s19 gcs19
765 # Aggregators debug level
766 .PHONY
: alldebug maps rees objdmps elfdmps
769 .PHONY
: mapsmsg reesmsg elfdmpsmsg objdmpmsg linkmsg gclinkmsg
770 .PHONY
: s19msg gcs19msg preprocessmsg compilemsg assemblemsg
773 .PHONY
: clean cleanasm cleanppc cleanobj cleanout cleans19 cleandebug cleanrelease