blob: d8a79f50ca40b1dfbdfddaa4e9ec2eb808369eaa [file] [log] [blame]
Stefan Taunerb3850962011-12-24 00:00:32 +00001CC ?= gcc
2
3PROGRAM=ich_descriptors_tool
4EXTRAINCDIRS = ../../ .
5DEPPATH = .dep
6OBJATH = .obj
7SHAREDSRC = ich_descriptors.c
8SHAREDSRCDIR = ../..
9
10SRC = $(wildcard *.c)
11
12CFLAGS += -Wall
13CFLAGS += -MMD -MP -MF $(DEPPATH)/$(@F).d
14# enables functions that populate the descriptor structs from plain binary dumps
15CFLAGS += -D ICH_DESCRIPTORS_FROM_DUMP
16CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
17
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000018ifeq ($(TARGET_OS), DOS)
19# DJGPP has odd uint*_t definitions which cause lots of format string warnings.
20CFLAGS += -Wno-format
21endif
22
Stefan Taunerb3850962011-12-24 00:00:32 +000023OBJ = $(OBJATH)/$(SRC:%.c=%.o)
24
25SHAREDOBJ = $(OBJATH)/$(notdir $(SHAREDSRC:%.c=%.o))
26
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000027all:$(PROGRAM)$(EXEC_SUFFIX)
Stefan Taunerb3850962011-12-24 00:00:32 +000028
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 Hailfinger60d9bd22012-08-09 23:34:41 +000037$(PROGRAM)$(EXEC_SUFFIX): $(OBJ) $(SHAREDOBJ)
38 $(CC) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJ) $(SHAREDOBJ)
Stefan Taunerb3850962011-12-24 00:00:32 +000039
40clean:
Carl-Daniel Hailfinger60d9bd22012-08-09 23:34:41 +000041 rm -f $(PROGRAM) $(PROGRAM).exe
Stefan Taunerb3850962011-12-24 00:00:32 +000042 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