blob: 1af90ced9d5796e71bc9390bc2407a8b5b071b25 [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
18OBJ = $(OBJATH)/$(SRC:%.c=%.o)
19
20SHAREDOBJ = $(OBJATH)/$(notdir $(SHAREDSRC:%.c=%.o))
21
22all:$(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
35clean:
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