Makefile 1.4 KB
Newer Older
1
include ../../scripts/Makefile.include
2
include ../../perf/config/utilities.mak		# QUIET_CLEAN
3

4 5 6
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar

7 8 9 10
# guard against environment variables
LIB_H=
LIB_OBJS=

11
LIB_H += fs/debugfs.h
12
LIB_H += fs/tracefs.h
13
LIB_H += fs/findfs.h
14
LIB_H += fs/fs.h
15 16
# See comment below about piggybacking...
LIB_H += fd/array.h
17

18
LIB_OBJS += $(OUTPUT)fs/debugfs.o
19
LIB_OBJS += $(OUTPUT)fs/tracefs.o
20
LIB_OBJS += $(OUTPUT)fs/findfs.o
21
LIB_OBJS += $(OUTPUT)fs/fs.o
22 23 24
# XXX piggybacking here, need to introduce libapikfd, or rename this
# to plain libapik.a and make it have it all api goodies
LIB_OBJS += $(OUTPUT)fd/array.o
25

26
LIBFILE = libapikfs.a
27

28
CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
29
EXTLIBS = -lelf -lpthread -lrt -lm
30 31 32 33 34 35 36 37 38 39
ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
ALL_LDFLAGS = $(LDFLAGS)

RM = rm -f

$(LIBFILE): $(LIB_OBJS)
	$(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS)

$(LIB_OBJS): $(LIB_H)

40
libapi_dirs:
41
	$(QUIET_MKDIR)mkdir -p $(OUTPUT)fd $(OUTPUT)fs
42 43

$(OUTPUT)%.o: %.c libapi_dirs
44
	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
45
$(OUTPUT)%.s: %.c libapi_dirs
46
	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
47
$(OUTPUT)%.o: %.S libapi_dirs
48 49 50
	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<

clean:
51
	$(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
52 53

.PHONY: clean