1 include ../../scripts/Makefile.include
3 CC = $(CROSS_COMPILE)gcc
4 AR = $(CROSS_COMPILE)ar
6 # Makefiles suck: This macro sets a default value of $(2) for the
7 # variable named by $(1), unless the variable has been set by
8 # environment or command line. This is necessary for CC and AR
9 # because make sets default values, so the simpler ?= approach
10 # won't work as expected.
12 $(if $(or $(findstring environment,$(origin $(1))),\
13 $(findstring command line,$(origin $(1)))),,\
17 # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
18 $(call allow-override,CC,$(CROSS_COMPILE)gcc)
19 $(call allow-override,AR,$(CROSS_COMPILE)ar)
21 # guard against environment variables
27 LIB_OBJS += $(OUTPUT)debugfs.o
31 CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
32 EXTLIBS = -lpthread -lrt -lelf -lm
33 ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
34 ALL_LDFLAGS = $(LDFLAGS)
38 $(LIBFILE): $(LIB_OBJS)
39 $(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS)
44 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
46 $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
48 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
51 $(RM) $(LIB_OBJS) $(LIBFILE)