Skip to content

Commit

Permalink
Merge pull request #77 from mgreter/master
Browse files Browse the repository at this point in the history
Aligns build system with autotools build and travis-ci
  • Loading branch information
mgreter committed Nov 3, 2014
2 parents 9ac5b69 + 1292cce commit 9bdb4df
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ compiler:
- gcc
- clang

env:
- AUTOTOOLS=no BUILD=shared
- AUTOTOOLS=no BUILD=static

before_install:
- gem install sass
- git clone https://github.com/sass/libsass.git
- cd libsass && git submodule init && git submodule update && cd ..
- export SASS_LIBSASS_PATH=libsass
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update -qq
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi

script:
- make test
32 changes: 26 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,35 @@ OBJECTS = $(SOURCES:.c=.o)
TARGET = bin/sassc
SPEC_PATH = $(SASS_SPEC_PATH)

ifneq ($(BUILD), shared)
BUILD = static
endif

all: libsass $(TARGET)

$(TARGET): $(OBJECTS) $(SASS_LIBSASS_PATH)/libsass.a
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(TARGET): build-$(BUILD)

build-static: $(OBJECTS) $(SASS_LIBSASS_PATH)/lib/libsass.a
$(CC) $(LDFLAGS) -o $(TARGET) $^ $(LDLIBS)

build-shared: $(OBJECTS) $(SASS_LIBSASS_PATH)/lib/libsass.so
$(CC) $(LDFLAGS) -o $(TARGET) $^ $(LDLIBS)

$(SASS_LIBSASS_PATH)/lib/libsass.a: libsass-static
$(SASS_LIBSASS_PATH)/lib/libsass.so: libsass-shared

libsass: libsass-$(BUILD)

libsass-static:
ifdef SASS_LIBSASS_PATH
BUILD="static" $(MAKE) -C $(SASS_LIBSASS_PATH)
else
$(error SASS_LIBSASS_PATH must be defined)
endif

$(SASS_LIBSASS_PATH)/libsass.a: libsass
libsass:
libsass-shared:
ifdef SASS_LIBSASS_PATH
$(MAKE) -C $(SASS_LIBSASS_PATH)
BUILD="shared" $(MAKE) -C $(SASS_LIBSASS_PATH)
else
$(error SASS_LIBSASS_PATH must be defined)
endif
Expand All @@ -48,5 +68,5 @@ ifdef SASS_LIBSASS_PATH
$(MAKE) -C $(SASS_LIBSASS_PATH) clean
endif

.PHONY: clean libsass test
.PHONY: clean libsass libsass-static libsass-shared build-static build-shared test
.DELETE_ON_ERROR:

0 comments on commit 9bdb4df

Please sign in to comment.