new makefile should let me have multiple targets
This commit is contained in:
parent
77b920ffaa
commit
668ab46fa2
31
Makefile
31
Makefile
|
@ -43,38 +43,43 @@ include $(TOPDIR)/config.mk
|
||||||
# blink objects....order is important (i.e. start must be first)
|
# blink objects....order is important (i.e. start must be first)
|
||||||
|
|
||||||
AOBJS =
|
AOBJS =
|
||||||
COBJS = src/blink.o
|
COBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
|
||||||
|
TARGETS = blink.o
|
||||||
|
|
||||||
# Add GCC lib
|
# Add GCC lib
|
||||||
PLATFORM_LIBS += --no-warn-mismatch -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
|
PLATFORM_LIBS += --no-warn-mismatch -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
|
||||||
ALL = blink.dis blink.srec blink.bin System.map
|
#ALL = blink.srec blink.bin blink.dis blink.System.map
|
||||||
|
ALL = $(TARGETS:.o=.srec) $(TARGETS:.o=.bin) $(TARGETS:.o=.dis)
|
||||||
|
|
||||||
|
.PRECIOUS: $(COBJS)
|
||||||
|
|
||||||
all: $(ALL)
|
all: $(ALL)
|
||||||
|
|
||||||
blink.srec: blink
|
%.srec: %.obj
|
||||||
$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
|
$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
|
||||||
|
|
||||||
blink.ihex: blink
|
%.ihex: %.obj
|
||||||
$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
|
$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
|
||||||
|
|
||||||
blink.bin: blink
|
%.bin: %.obj
|
||||||
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
|
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
|
||||||
|
|
||||||
blink.dis: blink
|
%.dis: %.obj
|
||||||
$(OBJDUMP) -DS $< > $@
|
$(OBJDUMP) -DS $< > $@
|
||||||
|
|
||||||
blink: $(AOBJS) $(COBJS) $(LDSCRIPT)
|
%.obj: $(AOBJS) $(COBJS) $(LDSCRIPT)
|
||||||
$(LD) $(LDFLAGS) $(AOBJS) $(COBJS) \
|
$(LD) $(LDFLAGS) $(AOBJS) $(COBJS) \
|
||||||
--start-group $(PLATFORM_LIBS) --end-group \
|
--start-group $(PLATFORM_LIBS) --end-group \
|
||||||
-Map blink.map -o blink
|
-Map $*.map -o $@
|
||||||
|
|
||||||
System.map: blink
|
|
||||||
|
%.System.map: %.obj
|
||||||
@$(NM) $< | \
|
@$(NM) $< | \
|
||||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||||
sort > System.map
|
sort > $*.System.map
|
||||||
|
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
|
@ -89,17 +94,17 @@ sinclude .depend
|
||||||
clean:
|
clean:
|
||||||
find . -type f \
|
find . -type f \
|
||||||
\( -name 'core' -o -name '*.bak' -o -name '*~' \
|
\( -name 'core' -o -name '*.bak' -o -name '*~' \
|
||||||
-o -name '*.o' -o -name '*.a' \) -print \
|
-o -name '*.o' -o -name '*.a' \) -print \
|
||||||
| xargs rm -f
|
| xargs rm -f
|
||||||
|
|
||||||
clobber: clean
|
clobber: clean
|
||||||
find . -type f \
|
find . -type f \
|
||||||
\( -name .depend -o -name '*.srec' -o -name '*.bin' \) \
|
\( -name .depend -o -name '*.srec' -o -name '*.bin' -o -name '*.dis' -o -name '*.map' \) \
|
||||||
-print \
|
-print \
|
||||||
| xargs rm -f
|
| xargs rm -f
|
||||||
rm -f $(OBJS) *.bak tags TAGS
|
rm -f $(OBJS) *.bak tags TAGS
|
||||||
rm -fr *.*~
|
rm -fr *.*~
|
||||||
rm -f blink blink.map $(ALL)
|
rm -f $(ALL)
|
||||||
|
|
||||||
mrproper \
|
mrproper \
|
||||||
distclean: clobber
|
distclean: clobber
|
||||||
|
|
Loading…
Reference in a new issue