xref: /openbmc/linux/tools/lib/api/Makefile (revision cde164ae)
1include ../../scripts/Makefile.include
2include ../../perf/config/utilities.mak		# QUIET_CLEAN
3
4CC = $(CROSS_COMPILE)gcc
5AR = $(CROSS_COMPILE)ar
6
7# guard against environment variables
8LIB_H=
9LIB_OBJS=
10
11LIB_H += fs/debugfs.h
12LIB_H += fs/findfs.h
13LIB_H += fs/fs.h
14# See comment below about piggybacking...
15LIB_H += fd/array.h
16
17LIB_OBJS += $(OUTPUT)fs/debugfs.o
18LIB_OBJS += $(OUTPUT)fs/findfs.o
19LIB_OBJS += $(OUTPUT)fs/fs.o
20# XXX piggybacking here, need to introduce libapikfd, or rename this
21# to plain libapik.a and make it have it all api goodies
22LIB_OBJS += $(OUTPUT)fd/array.o
23
24LIBFILE = libapikfs.a
25
26CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
27EXTLIBS = -lelf -lpthread -lrt -lm
28ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
29ALL_LDFLAGS = $(LDFLAGS)
30
31RM = rm -f
32
33$(LIBFILE): $(LIB_OBJS)
34	$(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS)
35
36$(LIB_OBJS): $(LIB_H)
37
38libapi_dirs:
39	$(QUIET_MKDIR)mkdir -p $(OUTPUT)fd $(OUTPUT)fs
40
41$(OUTPUT)%.o: %.c libapi_dirs
42	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
43$(OUTPUT)%.s: %.c libapi_dirs
44	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
45$(OUTPUT)%.o: %.S libapi_dirs
46	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
47
48clean:
49	$(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
50
51.PHONY: clean
52