1 # The toolchain definitions
5 V = @ # Verbose build: make V=1
6 C = 0 # Sparsechecker build: make C=1
8 QUIET_CC = $(Q:@=@echo ' CC '$@;)$(CC)
9 QUIET_DEPEND = $(Q:@=@echo ' DEPEND '$@;)$(CC)
11 QUIET_SPARSE = $(Q:@=@echo ' SPARSE '$@;)$(SPARSE)
13 QUIET_SPARSE = @/bin/true
17 CFLAGS += -std=c99 -O2 -fomit-frame-pointer -Wall -D_BSD_SOURCE
20 SRCS = ssb_sprom.c utils.c
24 .PHONY: all install clean distclean
27 DEPS = $(sort $(patsubst %.c,dep/%.d,$(1)))
28 OBJS = $(sort $(patsubst %.c,obj/%.o,$(1)))
30 # Generate dependencies
31 $(call DEPS,$(SRCS)): dep/%.d: %.c
33 $(QUIET_DEPEND) -o $@.tmp -MM -MT "$@ $(patsubst dep/%.d,obj/%.o,$@)" $(CFLAGS) $< && mv -f $@.tmp $@
35 -include $(call DEPS,$(SRCS))
37 # Generate object files
38 $(call OBJS,$(SRCS)): obj/%.o:
40 $(QUIET_SPARSE) $(SPARSEFLAGS) $<
41 $(QUIET_CC) -o $@ -c $(CFLAGS) $<
45 $(BIN): $(call OBJS,$(SRCS))
46 $(QUIET_CC) $(CFLAGS) -o $(BIN) $(call OBJS,$(SRCS)) $(LDFLAGS)
49 install -o 0 -g 0 -m 755 $(BIN) $(PREFIX)/bin/
52 -rm -Rf obj dep *~ *.orig *.rej