OBJCOPY = $(CROSS_COMPILE)objcopy\r
OBJDUMP = $(CROSS_COMPILE)objdump\r
OUTFILE = firmware\r
+\r
+CC_FOR_BUILD = gcc\r
LPCRC = ./lpcrc\r
\r
##########################################################################\r
dep: $(DEPS)\r
\r
$(DEPS) : %.dep : %.c\r
- $(CC) $(CPPFLAGS) $(CFLAGS) -MM $< -MT $@ -MT $(<:%.c=%.o) -MF $@\r
+ $(CC) $(CPPFLAGS) $(CFLAGS) -MM $< -MT $@ -MT $(@:%.dep=%.o) -MF $@\r
\r
sinclude $(DEPS)\r
\r
$(OUTFILE).elf: $(OBJS) $(LD_TEMP)\r
$(LD) $(LDFLAGS) -T $(LD_TEMP) -o $(OUTFILE).elf $(OBJS) $(LDLIBS)\r
\r
-$(OUTFILE).bin: $(OUTFILE).elf\r
+$(OUTFILE).bin: $(OUTFILE).elf $(LPCRC)\r
$(OBJCOPY) $(OCFLAGS) -O binary $(OUTFILE).elf $(OUTFILE).bin\r
$(LPCRC) $(OUTFILE).bin\r
\r
rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex\r
\r
distclean: clean\r
- rm -f $(DEPS)\r
+ rm -f $(DEPS) $(LPCRC)\r
\r
.PHONY: all dep size clean distclean\r
+\r
+CFLAGS_FOR_BUILD = -Wall -Wextra -std=c99 -O0 -g\r
+\r
+LPCRC_SRCS = tools/lpcrc/lpcrc.c\r
+LPCRC_OBJS = $(LPCRC_SRCS:%.c=%.o)\r
+LPCRC_DEPS = $(LPCRC_SRCS:%.c=%.dep)\r
+\r
+$(LPCRC_DEPS) : %.dep : %.c\r
+ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -MM $< -MT $@ -MT $(@:%.dep=%.o) -MF $@\r
+\r
+$(LPCRC_OBJS): %.o : %.c\r
+ $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ -c $<\r
+\r
+$(LPCRC): $(LPCRC_OBJS)\r
+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $+ $(LDLIBS_FOR_BUILD)\r