Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify build #49

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions Make.inc

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ clean:
rm -rf R-*

R-$(RVERSION).tar.gz:
wget https://cran.r-project.org/src/base/R-4/$@
curl -L -O https://cran.r-project.org/src/base/R-4/$@

update: R-$(RVERSION).tar.gz
tar -xzvf $< --strip-components 3 -C src --include '*/src/nmath/*.[ch]' \
Expand Down
35 changes: 29 additions & 6 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
include ../Make.inc
# -*- mode: makefile -*-

# Default value, can be overriden on the command line
# or with an environment variable.
CC ?= gcc

OS = $(shell uname)

ifneq (,$(findstring MINGW,$(OS)))
override OS := Windows_NT
endif
ifneq (,$(findstring MSYS,$(OS)))
override OS := Windows_NT
endif
ifneq (,$(findstring CYGWIN,$(OS)))
override OS := Windows_NT
endif

ifeq ($(OS), Darwin)
SHLIB_EXT = dylib
else ifeq ($(OS), Windows_NT)
SHLIB_EXT = dll
else
SHLIB_EXT = so
endif

SRCS = $(wildcard *.c)
OBJS = $(SRCS:%.c=%.o)
Expand All @@ -10,21 +34,20 @@ else
XOBJS = $(DOBJS)
endif

CFLAGS-add += -DMATHLIB_STANDALONE

CFLAGS += -DMATHLIB_STANDALONE -fPIC -O3 -std=c99 -I../include

default: release

%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS-add) $(CFLAGS) $(fPIC) -std=gnu99 -I../include -DNDEBUG -c $< -o $@
$(CC) $(CPPFLAGS) $(CFLAGS) -DNDEBUG -c $< -o $@
%.do: %.c
$(CC) $(CPPFLAGS) $(CFLAGS-add) $(CFLAGS) $(fPIC) -std=gnu99 -I../include -g -c $< -o $@
$(CC) $(CPPFLAGS) $(CFLAGS) -g -c $< -o $@

release debug: libRmath-julia.$(SHLIB_EXT)

libRmath-julia.$(SHLIB_EXT): $(XOBJS)
-rm -f $@
$(CC) $(LDFLAGS-add) $(LDFLAGS) -shared -o $@ $^
$(CC) $(LDFLAGS) -shared -o $@ $^

clean:
-rm -f *.o *.do *.a *.$(SHLIB_EXT) core* *~ *#