8 QUIETLY = 1>/dev/null 2>/dev/null
10 ##### sources, objects and libraries #####
12 AR_BINARY = $(BINDIR)/$(BINNAME).a
13 SO_BINARY = $(BINDIR)/$(BINNAME).so
14 SRCDIRS = lfds600_abstraction lfds600_freelist lfds600_queue lfds600_ringbuffer lfds600_slist lfds600_stack
15 # TRD : be aware - in the linux makefile, with the one-pass linking behaviour of the GNU linker, the order
16 # of source files matters! this is because it leads to the ordering of objects in the library and
17 # that in turn, since the data structures all use the freelist API and the abstraction API, has to be
19 SOURCES = lfds600_queue_delete.c lfds600_queue_new.c lfds600_queue_query.c lfds600_queue_queue.c \
20 lfds600_ringbuffer_delete.c lfds600_ringbuffer_get_and_put.c lfds600_ringbuffer_new.c lfds600_ringbuffer_query.c \
21 lfds600_slist_delete.c lfds600_slist_get_and_set.c lfds600_slist_link.c lfds600_slist_new.c \
22 lfds600_stack_delete.c lfds600_stack_new.c lfds600_stack_push_pop.c lfds600_stack_query.c \
23 lfds600_freelist_delete.c lfds600_freelist_get_and_set.c lfds600_freelist_new.c lfds600_freelist_query.c lfds600_freelist_pop_push.c \
24 lfds600_abstraction_aligned_free.c lfds600_abstraction_aligned_malloc.c lfds600_abstraction_cas.c lfds600_abstraction_dcas.c lfds600_abstraction_increment.c
25 OBJECTS = $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES)))
27 ##### CPU variants #####
28 GCCARCH = $(shell uname -m)
30 ifeq ($(GCCARCH),x86_64)
34 ifeq ($(findstring arm,$(GCCARCH)),arm)
43 DGFLAGS = -MM -std=c99 -I"$(SRCDIR)" -I"$(INCDIR)"
46 CBASE = -Wall -Wno-unknown-pragmas -std=c99 -march=$(GCCARCH) -c -I"$(SRCDIR)" -I"$(INCDIR)"
47 CFREL = -O2 -finline-functions -Wno-strict-aliasing
54 LFBASE = -Wall -std=c99 -shared
58 ##### rel/dbg .a/.so variants #####
59 ifeq ($(findstring so,$(MAKECMDGOALS)),so)
60 CBASE := $(CBASE) -fpic
63 CFLAGS = $(CBASE) $(CFDBG)
64 LFLAGS = $(LFBASE) $(LFDBG)
66 ifeq ($(findstring rel,$(MAKECMDGOALS)),rel)
67 CFLAGS = $(CBASE) $(CFREL)
68 LFLAGS = $(LFBASE) $(LFREL)
71 ##### search paths #####
72 vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS))
74 ##### implicit rules #####
76 $(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d
77 $(CC) $(CFLAGS) -o $@ $<
79 ##### explicit rules #####
80 $(AR_BINARY) : $(OBJECTS)
81 $(AR) $(AFLAGS) $(AR_BINARY) $(OBJECTS)
83 $(SO_BINARY) : $(OBJECTS)
84 $(LD) $(LFLAGS) $(SYSLIBS) $(OBJECTS) -o $(SO_BINARY)
87 .PHONY : clean arrel ardbg sorel sodbg
90 @rm -f $(BINDIR)/$(BINNAME).* $(OBJDIR)/*.o $(OBJDIR)/*.d
98 ##### dependencies #####
102 # TRD : we use -std=c99 purely to permit C++ style comments