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 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 18 | ifeq ($(TARGET_OS), DOS) |
| 19 | # DJGPP has odd uint*_t definitions which cause lots of format string warnings. |
| 20 | CFLAGS += -Wno-format |
| 21 | endif |
| 22 | |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 23 | OBJ = $(OBJATH)/$(SRC:%.c=%.o) |
| 24 | |
| 25 | SHAREDOBJ = $(OBJATH)/$(notdir $(SHAREDSRC:%.c=%.o)) |
| 26 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 27 | all:$(PROGRAM)$(EXEC_SUFFIX) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 28 | |
| 29 | $(OBJ): $(OBJATH)/%.o : %.c |
| 30 | $(CC) $(CFLAGS) -o $@ -c $< |
| 31 | |
| 32 | # this enables us to share source files without simultaneously sharing .o files |
| 33 | # with flashrom, which would lead to unexpected results (w/o running make clean) |
| 34 | $(SHAREDOBJ): $(OBJATH)/%.o : $(SHAREDSRCDIR)/%.c |
| 35 | $(CC) $(CFLAGS) -o $@ -c $< |
| 36 | |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 37 | $(PROGRAM)$(EXEC_SUFFIX): $(OBJ) $(SHAREDOBJ) |
| 38 | $(CC) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJ) $(SHAREDOBJ) |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 39 | |
| 40 | clean: |
Carl-Daniel Hailfinger | 60d9bd2 | 2012-08-09 23:34:41 +0000 | [diff] [blame] | 41 | rm -f $(PROGRAM) $(PROGRAM).exe |
Stefan Tauner | b385096 | 2011-12-24 00:00:32 +0000 | [diff] [blame] | 42 | rm -rf $(DEPPATH) $(OBJATH) |
| 43 | |
| 44 | # Include the dependency files. |
| 45 | -include $(shell mkdir -p $(DEPPATH) $(OBJATH) 2>/dev/null) $(wildcard $(DEPPATH)/*) |
| 46 | |
| 47 | .PHONY: all clean |