Files

68 lines
1.4 KiB
Makefile
Raw Permalink Normal View History

# SPDX-License-Identifier: GPL-2.0
2013-02-20 16:32:30 +01:00
include ../../scripts/Makefile.include
include ../../scripts/utilities.mak # QUIET_CLEAN
2013-02-20 16:32:30 +01:00
2015-01-09 16:38:25 +01:00
ifeq ($(srctree),)
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
2015-01-09 16:38:25 +01:00
srctree := $(patsubst %/,%,$(dir $(srctree)))
srctree := $(patsubst %/,%,$(dir $(srctree)))
#$(info Determined 'srctree' to be $(srctree))
endif
CC ?= $(CROSS_COMPILE)gcc
AR ?= $(CROSS_COMPILE)ar
LD ?= $(CROSS_COMPILE)ld
2013-05-17 22:27:44 +02:00
2015-01-09 16:38:25 +01:00
MAKEFLAGS += --no-print-directory
2013-02-20 16:32:30 +01:00
LIBFILE = $(OUTPUT)libapi.a
2013-02-20 16:32:30 +01:00
2015-01-09 16:38:25 +01:00
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
2017-09-08 10:46:19 +02:00
CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE -fPIC
2017-09-08 10:46:19 +02:00
ifeq ($(DEBUG),0)
ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3
else
CFLAGS += -O6
endif
2017-09-08 10:46:19 +02:00
endif
ifeq ($(DEBUG),0)
CFLAGS += -D_FORTIFY_SOURCE
endif
2016-06-30 22:12:32 -07:00
# Treat warnings as errors unless directed not to
ifneq ($(WERROR),0)
CFLAGS += -Werror
endif
2015-01-09 16:38:25 +01:00
CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
2016-02-14 17:03:42 +01:00
CFLAGS += -I$(srctree)/tools/lib/api
2016-07-08 15:26:50 -03:00
CFLAGS += -I$(srctree)/tools/include
2013-02-20 16:32:30 +01:00
RM = rm -f
API_IN := $(OUTPUT)libapi-in.o
2013-02-20 16:32:30 +01:00
all:
2015-01-09 16:38:25 +01:00
export srctree OUTPUT CC LD CFLAGS V
2015-09-23 12:33:56 +02:00
include $(srctree)/tools/build/Makefile.include
2013-02-20 16:32:30 +01:00
all: fixdep $(LIBFILE)
2013-12-09 17:14:23 +01:00
2015-01-09 16:38:25 +01:00
$(API_IN): FORCE
@$(MAKE) $(build)=libapi
2015-01-09 16:38:25 +01:00
$(LIBFILE): $(API_IN)
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
2013-02-20 16:32:30 +01:00
clean:
$(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
2022-02-11 14:14:11 +09:00
find $(or $(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
2013-02-20 16:32:30 +01:00
2015-01-09 16:38:25 +01:00
FORCE:
.PHONY: clean FORCE