blob: 36c08b1f4afbc9379007c3b49e79fb5f87a3f1c9 [file] [log] [blame]
Borislav Petkov85c66be2013-02-20 16:32:30 +01001include ../../scripts/Makefile.include
Borislav Petkov553873e2013-12-09 17:14:23 +01002include ../../perf/config/utilities.mak # QUIET_CLEAN
Borislav Petkov85c66be2013-02-20 16:32:30 +01003
Rabin Vincent3c4797d2013-05-17 22:27:44 +02004CC = $(CROSS_COMPILE)gcc
5AR = $(CROSS_COMPILE)ar
6
Borislav Petkov85c66be2013-02-20 16:32:30 +01007# guard against environment variables
8LIB_H=
9LIB_OBJS=
10
Borislav Petkov553873e2013-12-09 17:14:23 +010011LIB_H += fs/debugfs.h
Borislav Petkovcd0cfad2013-12-09 17:14:24 +010012LIB_H += fs/fs.h
Arnaldo Carvalho de Melo1b853372014-09-03 18:02:59 -030013# See comment below about piggybacking...
14LIB_H += fd/array.h
Borislav Petkov85c66be2013-02-20 16:32:30 +010015
Borislav Petkov553873e2013-12-09 17:14:23 +010016LIB_OBJS += $(OUTPUT)fs/debugfs.o
Borislav Petkovcd0cfad2013-12-09 17:14:24 +010017LIB_OBJS += $(OUTPUT)fs/fs.o
Arnaldo Carvalho de Melo1b853372014-09-03 18:02:59 -030018# 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
Borislav Petkov85c66be2013-02-20 16:32:30 +010021
Borislav Petkov553873e2013-12-09 17:14:23 +010022LIBFILE = libapikfs.a
Borislav Petkov85c66be2013-02-20 16:32:30 +010023
Borislav Petkovb28b1302013-03-03 20:25:33 +010024CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
Mike Frysingerd14c4962013-05-09 00:17:44 -040025EXTLIBS = -lelf -lpthread -lrt -lm
Borislav Petkov85c66be2013-02-20 16:32:30 +010026ALL_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
Borislav Petkov553873e2013-12-09 17:14:23 +010036libapi_dirs:
Arnaldo Carvalho de Melo1b853372014-09-03 18:02:59 -030037 $(QUIET_MKDIR)mkdir -p $(OUTPUT)fd $(OUTPUT)fs
Borislav Petkov553873e2013-12-09 17:14:23 +010038
39$(OUTPUT)%.o: %.c libapi_dirs
Borislav Petkov85c66be2013-02-20 16:32:30 +010040 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
Borislav Petkov553873e2013-12-09 17:14:23 +010041$(OUTPUT)%.s: %.c libapi_dirs
Borislav Petkov85c66be2013-02-20 16:32:30 +010042 $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
Borislav Petkov553873e2013-12-09 17:14:23 +010043$(OUTPUT)%.o: %.S libapi_dirs
Borislav Petkov85c66be2013-02-20 16:32:30 +010044 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
45
46clean:
Borislav Petkov553873e2013-12-09 17:14:23 +010047 $(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
Borislav Petkov85c66be2013-02-20 16:32:30 +010048
49.PHONY: clean