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