Commit a7ddccf8 by Craig Barnes

Improve Makefile

* Remove "-c" from CFLAGS and hard-code it into the recipe -- CFLAGS
  should be overridable from the command-line but not including "-c"
  should never invoke the linker on object files
* Use real target names for library files instead of phony targets
* Add install and install-shared targets
* Use $(OBJECTS) instead of *.o
* Use .PHONY to properly mark phony targets
parent 5bd4581b
CC=g++
CFLAGS=-c -Wall -O2 -fPIC
LDFLAGS= -fPIC
SOURCES = \
constants.cpp context.cpp functions.cpp document.cpp \
document_parser.cpp eval_apply.cpp node.cpp \
node_factory.cpp node_emitters.cpp prelexer.cpp \
sass_interface.cpp
CC = g++
CFLAGS = -Wall -O2 -fPIC
LDFLAGS = -fPIC
PREFIX = /usr/local
LIBDIR = $(PREFIX)/lib
SOURCES = constants.cpp context.cpp functions.cpp document.cpp \
document_parser.cpp eval_apply.cpp node.cpp \
node_factory.cpp node_emitters.cpp prelexer.cpp \
sass_interface.cpp
OBJECTS = $(SOURCES:.cpp=.o)
all: $(OBJECTS)
ar rvs libsass.a $(OBJECTS)
static: libsass.a
shared: libsass.so
libsass.a: $(OBJECTS)
ar rvs $@ $(OBJECTS)
shared: $(OBJECTS)
$(CC) -shared -o libsass.so *.o
libsass.so: $(OBJECTS)
$(CC) -shared $(LDFLAGS) -o $@ $(OBJECTS)
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
$(CC) $(CFLAGS) -c -o $@ $<
install: libsass.a
install -Dpm0755 $< $(DESTDIR)$(LIBDIR)/$<
install-shared: libsass.so
install -Dpm0755 $< $(DESTDIR)$(LIBDIR)/$<
clean:
rm -rf *.o *.a *.so
\ No newline at end of file
rm -f $(OBJECTS) *.a *.so
.PHONY: static shared install install-static clean
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