Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 1 | include ../../scripts/Makefile.include |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 2 | include ../../perf/config/utilities.mak # QUIET_CLEAN |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 3 | |
Rabin Vincent | 3c4797d | 2013-05-17 22:27:44 +0200 | [diff] [blame] | 4 | CC = $(CROSS_COMPILE)gcc |
| 5 | AR = $(CROSS_COMPILE)ar |
| 6 | |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 7 | # guard against environment variables |
| 8 | LIB_H= |
| 9 | LIB_OBJS= |
| 10 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 11 | LIB_H += fs/debugfs.h |
Borislav Petkov | cd0cfad | 2013-12-09 17:14:24 +0100 | [diff] [blame] | 12 | LIB_H += fs/fs.h |
Arnaldo Carvalho de Melo | 1b85337 | 2014-09-03 18:02:59 -0300 | [diff] [blame] | 13 | # See comment below about piggybacking... |
| 14 | LIB_H += fd/array.h |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 15 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 16 | LIB_OBJS += $(OUTPUT)fs/debugfs.o |
Borislav Petkov | cd0cfad | 2013-12-09 17:14:24 +0100 | [diff] [blame] | 17 | LIB_OBJS += $(OUTPUT)fs/fs.o |
Arnaldo Carvalho de Melo | 1b85337 | 2014-09-03 18:02:59 -0300 | [diff] [blame] | 18 | # XXX piggybacking here, need to introduce libapikfd, or rename this |
| 19 | # to plain libapik.a and make it have it all api goodies |
| 20 | LIB_OBJS += $(OUTPUT)fd/array.o |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 21 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 22 | LIBFILE = libapikfs.a |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 23 | |
Borislav Petkov | b28b130 | 2013-03-03 20:25:33 +0100 | [diff] [blame] | 24 | CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC |
Mike Frysinger | d14c496 | 2013-05-09 00:17:44 -0400 | [diff] [blame] | 25 | EXTLIBS = -lelf -lpthread -lrt -lm |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 26 | ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 |
| 27 | ALL_LDFLAGS = $(LDFLAGS) |
| 28 | |
| 29 | RM = rm -f |
| 30 | |
| 31 | $(LIBFILE): $(LIB_OBJS) |
| 32 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS) |
| 33 | |
| 34 | $(LIB_OBJS): $(LIB_H) |
| 35 | |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 36 | libapi_dirs: |
Arnaldo Carvalho de Melo | 1b85337 | 2014-09-03 18:02:59 -0300 | [diff] [blame] | 37 | $(QUIET_MKDIR)mkdir -p $(OUTPUT)fd $(OUTPUT)fs |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 38 | |
| 39 | $(OUTPUT)%.o: %.c libapi_dirs |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 40 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 41 | $(OUTPUT)%.s: %.c libapi_dirs |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 42 | $(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $< |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 43 | $(OUTPUT)%.o: %.S libapi_dirs |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 44 | $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< |
| 45 | |
| 46 | clean: |
Borislav Petkov | 553873e | 2013-12-09 17:14:23 +0100 | [diff] [blame] | 47 | $(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE) |
Borislav Petkov | 85c66be | 2013-02-20 16:32:30 +0100 | [diff] [blame] | 48 | |
| 49 | .PHONY: clean |