cyclone/Makefile.config.raspberry-pi-2
Sören Tempel 3bf376c057 Don't use conditional assignment operator for CFLAGS/LDFLAGS
The conditional variable assignment operator in Makefiles (`?=`) will
only assign a value if its not defined yet. However, CFLAGS/LDFLAGS are
commonly defined as environment variables to pass custom compiler/linker
flags (e.g. `-Os`). Unfortunately, Cyclone adds mandatory compiler flags
(without which it doesn't compile) via the conditional variable
assignment operator which is incorrect as these flags will not be added
if CFLAGS/LDFLAGS is defined in the environment. This commit fixes this
issue by appending flags to CFLAGS/LDFLAGS instead of using the
conditional assignment operator.
2021-08-03 06:04:11 +02:00

95 lines
2.6 KiB
Text

# Cyclone Scheme
# Copyright (c) 2014, Justin Ethier
# All rights reserved.
#
# Configuration options for the makefile
& = $(filter-out %.h %.d,$^)
OS ?= $(shell uname)
CC ?= cc
LIBS = -pthread -lcyclone -lck -lm -lcyclonebn
ifneq ($(OS),FreeBSD)
# libdl is part of libc on FreeBSD
LIBS += -ldl
endif
LIBRARY_OUTPUT_FILE = libcyclone.a
CREATE_LIBRARY_COMMAND = $(AR)
CREATE_LIBRARY_FLAGS = rcs
# Compiler options
CFLAGS += -O2 -fPIC -Wall -march=armv6k -Iinclude
COMP_CFLAGS ?= -O2 -fPIC -Wall -march=armv6k -I$(PREFIX)/include -L$(PREFIX)/lib
# Use these lines instead for debugging or profiling
#CFLAGS = -g -Wall
#CFLAGS = -g -pg -Wall
# Linker options
LDFLAGS += -L.
ifeq ($(OS),Darwin)
LDFLAGS += -Wl,-export_dynamic -Wl,-undefined -Wl,dynamic_lookup
COMP_CFLAGS += -Wl,-export_dynamic
else
LDFLAGS += -Wl,--export-dynamic
COMP_CFLAGS += -Wl,--export-dynamic
endif
# /usr/local is not in the search path by default on FreeBSD, so if libtommath and/or
# concurrencykit was installed via Ports, it won't be picked up without explicitly looking
# for it here
ifeq ($(OS),FreeBSD)
LDFLAGS += -L/usr/local/lib
CFLAGS += -I/usr/local/include
endif
# Commands "baked into" cyclone for invoking the C compiler
CC_PROG ?= "$(CC) ~src-file~ $(COMP_CFLAGS) -c -o ~exec-file~.o"
CC_EXEC ?= "$(CC) ~exec-file~.o ~obj-files~ $(LIBS) $(COMP_CFLAGS) -o ~exec-file~"
CC_LIB ?= "$(CC) ~src-file~ $(COMP_CFLAGS) -c -o ~exec-file~.o"
CC_SO ?= "$(CC) -shared $(LDFLAGS) -o ~exec-file~.so ~exec-file~.o"
AR ?= ar
#CD ?= cd
RM ?= rm -f
#LS ?= ls
#CP ?= cp
#LN ?= ln
INSTALL ?= install
MKDIR ?= $(INSTALL) -d
RMDIR ?= rmdir
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
INCDIR ?= $(PREFIX)/include/cyclone
DATADIR ?= $(PREFIX)/share/cyclone
DESTDIR ?=
# Automatically detect platform-specific flags, instead of using autoconf
#CYC_PLATFORM_HAS_MEMSTREAM ?= 1
CYC_PLATFORM_HAS_MEMSTREAM := $(shell echo "main(){char *buf; int len; open_memstream(&buf, &len);}" | $(CC) -xc - >/dev/null 2>/dev/null && echo 1 || echo 0)
CYC_PLATFORM_HAS_FMEMOPEN := $(shell echo "main(){char *buf; fmemopen(&buf, 0, \"r\");}" | $(CC) -xc - >/dev/null 2>/dev/null && echo 1 || echo 0)
# code from chibi's makefile to detect platform
ifndef PLATFORM
ifeq ($(OS),Darwin)
PLATFORM=macosx
else ifneq (,$(findstring $(OS),FreeBSD NetBSD OpenBSD DragonFly))
PLATFORM=bsd
else ifeq ($(shell uname -o),Msys)
PLATFORM=mingw
SOLIBDIR = $(BINDIR)
DIFFOPTS = -b
else ifeq ($(shell uname -o),Cygwin)
PLATFORM=cygwin
SOLIBDIR = $(BINDIR)
DIFFOPTS = -b
else ifeq ($(shell uname -o),GNU/Linux)
PLATFORM=linux
else
PLATFORM=unix
endif
endif