summaryrefslogtreecommitdiff
path: root/lib/fixedpoint/fixedpoint.make
blob: 5be0e38ea79aa0d5e9c0fc704c74e452f1a0601f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#             __________               __   ___.
#   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
#   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
#   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
#   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
#                     \/            \/     \/    \/            \/

FIXEDPOINTLIB := $(BUILDDIR)/lib/libfixedpoint.a
FIXEDPOINTLIB_DIR := $(ROOTDIR)/lib/fixedpoint
FIXEDPOINTLIB_SRC := $(FIXEDPOINTLIB_DIR)/fixedpoint.c
FIXEDPOINTLIB_OBJ := $(call c2obj, $(FIXEDPOINTLIB_SRC))

INCLUDES += -I$(FIXEDPOINTLIB_DIR)
OTHER_SRC += $(FIXEDPOINTLIB_SRC)

CORE_LIBS += $(FIXEDPOINTLIB)
CORE_GCSECTIONS := yes

FIXEDPOINTLIB_FLAGS := $(CFLAGS) $(SHARED_CFLAGS)

# Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim
ifneq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
    FIXEDPOINTLIB_FLAGS += -ffunction-sections -fdata-sections
endif

$(FIXEDPOINTLIB_OBJ): $(FIXEDPOINTLIB_SRC)
	$(SILENT)mkdir -p $(dir $@)
	$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) \
		$(FIXEDPOINTLIB_FLAGS) -c $< -o $@

$(FIXEDPOINTLIB): $(FIXEDPOINTLIB_OBJ)
	$(SILENT)$(shell rm -f $@)
	$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null