Merge pull request #482 from nmeum/search-path-prepending

Allow prepending include/library search path through -COPT/-CLNK
This commit is contained in:
Justin Ethier 2021-11-30 21:51:11 -05:00 committed by GitHub
commit 25165b6782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 27 deletions

View file

@ -31,14 +31,11 @@ endif
CFLAGS += $(CYC_PROFILING) $(CYC_GCC_OPT_FLAGS) -fPIC -Wall -Wno-shift-negative-value -Wno-unused-command-line-argument -Iinclude
BASE_CFLAGS ?= $(CYC_PROFILING) $(CYC_GCC_OPT_FLAGS) -fPIC -Wall -Wno-shift-negative-value -Wno-unused-command-line-argument -I$(PREFIX)/include
# Used by Cyclone to compile programs, no need for PIC there
BASE_PROG_CFLAGS ?= $(CYC_PROFILING) $(CYC_GCC_OPT_FLAGS) -Wall -I$(PREFIX)/include
ifeq ($(OS),Darwin)
COMP_CFLAGS ?= $(BASE_CFLAGS) -L$(PREFIX)/lib
COMP_PROG_CFLAGS ?= $(BASE_PROG_CFLAGS)
else
COMP_CFLAGS ?= $(BASE_CFLAGS) -L$(PREFIX)/lib
COMP_PROG_CFLAGS ?= $(BASE_PROG_CFLAGS)
endif
BASE_PROG_CFLAGS ?= $(CYC_PROFILING) $(CYC_GCC_OPT_FLAGS) -Wall
COMP_CFLAGS ?= $(BASE_CFLAGS)
COMP_LIBDIRS ?= -L$(PREFIX)/lib
COMP_INCDIRS ?= -I$(PREFIX)/include
COMP_PROG_CFLAGS ?= $(BASE_PROG_CFLAGS)
# Use these lines instead for debugging or profiling
#CFLAGS = -g -Wall
@ -62,15 +59,15 @@ endif
# 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
COMP_LIBDIRS += -L/usr/local/lib
COMP_INCDIRS += -I/usr/local/include
endif
# Commands "baked into" cyclone for invoking the C compiler
CC_PROG ?= "$(CC) ~src-file~ $(COMP_PROG_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_PROG ?= "$(CC) ~src-file~ $(COMP_PROG_CFLAGS) ~cc-extra~ $(COMP_INCDIRS) -c -o ~exec-file~.o"
CC_EXEC ?= "$(CC) ~exec-file~.o ~obj-files~ $(LIBS) $(COMP_CFLAGS) ~ld-extra~ $(COMP_LIBDIRS) -o ~exec-file~"
CC_LIB ?= "$(CC) ~src-file~ $(COMP_CFLAGS) ~cc-extra~ $(COMP_LIBDIRS) -c -o ~exec-file~.o"
CC_SO ?= "$(CC) -shared $(LDFLAGS) -o ~exec-file~.so ~exec-file~.o"
AR ?= ar

View file

@ -882,27 +882,27 @@
(string-append
(string-replace-all
(string-replace-all
;(Cyc-compilation-environment 'cc-prog)
(get-comp-env 'cc-prog cc-prog)
"~src-file~" src-file)
(string-replace-all
;(Cyc-compilation-environment 'cc-prog)
(get-comp-env 'cc-prog cc-prog)
"~src-file~" src-file)
"~cc-extra~" cc-opts)
"~exec-file~" exec-file)
" "
cc-opts
" "
cc-opts*))
(comp-objs-cmd
(string-append
(string-replace-all
(string-replace-all
(string-replace-all
;(Cyc-compilation-environment 'cc-exec)
(get-comp-env 'cc-exec cc-exec)
"~exec-file~" exec-file)
(string-replace-all
;(Cyc-compilation-environment 'cc-exec)
(get-comp-env 'cc-exec cc-exec)
"~exec-file~" exec-file)
"~ld-extra~" cc-prog-linker-opts)
"~obj-files~" objs-str)
"~exec-file~" exec-file)
" "
cc-prog-linker-opts
" "
c-linker-options
)))
;(write `(DEBUG all imports ,lib-deps objs ,objs-str))
@ -922,12 +922,12 @@
(string-append
(string-replace-all
(string-replace-all
(get-comp-env 'cc-lib cc-lib)
"~src-file~" src-file)
(string-replace-all
(get-comp-env 'cc-lib cc-lib)
"~src-file~" src-file)
"~cc-extra~" cc-opts)
"~exec-file~" exec-file)
" "
cc-opts
" "
cc-opts*))
(comp-so-cmd
(string-append