Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 1 | CC ?= gcc |
| 2 | |
| 3 | PROGRAM=ich_descriptors_tool |
| 4 | EXTRAINCDIRS = ../../ . |
| 5 | DEPPATH = .dep |
| 6 | OBJATH = .obj |
| 7 | SHAREDSRC = ich_descriptors.c |
| 8 | SHAREDSRCDIR = ../.. |
| 9 | |
| 10 | SRC = $(wildcard *.c) |
| 11 | |
| 12 | CFLAGS += -Wall |
| 13 | CFLAGS += -MMD -MP -MF $(DEPPATH)/$(@F).d |
| 14 | # enables functions that populate the descriptor structs from plain binary dumps |
| 15 | CFLAGS += -D ICH_DESCRIPTORS_FROM_DUMP |
| 16 | CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) |
| 17 | |
| 18 | OBJ = $(OBJATH)/$(SRC:%.c=%.o) |
| 19 | |
| 20 | SHAREDOBJ = $(OBJATH)/$(notdir $(SHAREDSRC:%.c=%.o)) |
| 21 | |
| 22 | all:$(PROGRAM) |
| 23 | |
| 24 | $(OBJ): $(OBJATH)/%.o : %.c |
| 25 | $(CC) $(CFLAGS) -o $@ -c $< |
| 26 | |
| 27 | # this enables us to share source files without simultaneously sharing .o files |
| 28 | # with flashrom, which would lead to unexpected results (w/o running make clean) |
| 29 | $(SHAREDOBJ): $(OBJATH)/%.o : $(SHAREDSRCDIR)/%.c |
| 30 | $(CC) $(CFLAGS) -o $@ -c $< |
| 31 | |
| 32 | $(PROGRAM): $(OBJ) $(SHAREDOBJ) |
| 33 | $(CC) -o $(PROGRAM) $(OBJ) $(SHAREDOBJ) |
| 34 | |
| 35 | clean: |
| 36 | rm -f $(PROGRAM) |
| 37 | rm -rf $(DEPPATH) $(OBJATH) |
| 38 | |
| 39 | # Include the dependency files. |
| 40 | -include $(shell mkdir -p $(DEPPATH) $(OBJATH) 2>/dev/null) $(wildcard $(DEPPATH)/*) |
| 41 | |
| 42 | .PHONY: all clean |