update Makefile to respect CFLAGS

parent 7a6a41c1
# Makefile for librinterpolate
# we want to use gcc to build and link, but use CC and LD
......@@ -7,27 +6,27 @@ CC ?= $(CC)
CC ?= gcc
LD_LIBRARY_PATH ?= /home/izzard/lib:/home/izzard/svn/bin/lib
MAKE ?= /usr/bin/make
INCDIRS ?= -I.
LIBS ?= -lm -lc
INCDIRS ?= -I.
LIBS ?= -lm -lc
LDFLAGS ?=
C_SRC := $(wildcard *.c)
C_SRC := $(wildcard *.c)
OBJECTS := $(C_SRC:.c=.o)
CFLAGS := -O3 $(COPTFLAGS) $(LIBRINTERPOLATE_ARCHFLAGS)
CFLAGS ?= -O3 $(COPTFLAGS) $(LIBRINTERPOLATE_ARCHFLAGS)
REQCFLAGS := -fPIC -g -std=gnu99 -D__RINTERPOLATE__ -Wall -Wstrict-prototypes -Wno-nonnull-compare -Wformat-signedness -Wformat -D__RINTERPOLATE_BUILD_BUILD_FLAGS__
ifeq ($(PREFIX),)
PREFIX := /usr/local
PREFIX := /usr/local
endif
%.o : %.c
$(CC) -c $(CFLAGS) $(REQCFLAGS) $(INCDIRS) $< -o $@
.PHONY: clean install
.PHONY: clean install
librinterpolate: $(OBJECTS)
# make shared library
$(CC) $(CFLAGS) -shared -Wl,-soname,librinterpolate.so,--export-dynamic -fvisibility=hidden -o librinterpolate.so $(LDFLAGS) $(LIBS) $(OBJECTS)
# make static library
ar rcs librinterpolate.a $(OBJECTS)
ar rcs librinterpolate.a $(OBJECTS)
# make test executable
$(CC) $(CFLAGS) $(REQCFLAGS) -D__TEST_RINTERPOLATE__ test_rinterpolate.c -o test_rinterpolate -lc -lm -ldl $(OBJECTS) -lm
# make config
......@@ -39,7 +38,7 @@ clean:
# install to PREFIX
# note that we assume ldconfig is in /sbin/
install:
install:
install -d $(DESTDIR)$(PREFIX)/lib
install -m 644 librinterpolate.so $(DESTDIR)$(PREFIX)/lib
install -m 644 librinterpolate.a $(DESTDIR)$(PREFIX)/lib
......@@ -49,5 +48,3 @@ install:
install -m 644 rinterpolate_compiler.h $(DESTDIR)$(PREFIX)/include
install -d $(DESTDIR)$(PREFIX)/bin
install -m 755 rinterpolate-config $(DESTDIR)$(PREFIX)/bin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment