Skip to content

Commit 713e162

Browse files
committed
Merge pull request #1352 from mgreter/feature/source-reorganization
Move source files into `src` subfolder
2 parents 10a4b63 + bc802ba commit 713e162

File tree

118 files changed

+606
-389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+606
-389
lines changed

.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ VERSION
1515
Makefile.in
1616
/aclocal.m4
1717
/autom4te.cache/
18-
/config.h
18+
/src/config.h
1919
/config.h.in
2020
/config.log
2121
/config.status
2222
/configure
23-
include/
2423
/libtool
2524
/m4/libtool.m4
2625
/m4/ltoptions.m4
@@ -37,7 +36,7 @@ include/
3736
/script/missing
3837
/script/test-driver
3938
/stamp-h1
40-
src/Makefile
39+
/src/Makefile
4140
libsass/*
4241

4342
# Build stuff
@@ -67,8 +66,10 @@ win/bin
6766

6867
sassc++
6968
libsass.la
70-
support/libsass.pc
69+
src/support/libsass.pc
7170

7271
# Cloned testing dirs
7372
sassc/
7473
sass-spec/
74+
75+
installer/

Makefile

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ RM ?= rm -f
44
CP ?= cp -a
55
MKDIR ?= mkdir
66
WINDRES ?= windres
7+
INSTALL ?= install
78
CFLAGS ?= -Wall
89
CXXFLAGS ?= -Wall
910
LDFLAGS ?= -Wall
@@ -33,6 +34,10 @@ else
3334
endif
3435
endif
3536

37+
ifeq ($(SASS_LIBSASS_PATH),)
38+
SASS_LIBSASS_PATH = $(abspath $(CURDIR))
39+
endif
40+
3641
ifeq ($(LIBSASS_VERSION),)
3742
ifneq ($(wildcard ./.git/ ),)
3843
LIBSASS_VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags)
@@ -68,8 +73,12 @@ else
6873
endif
6974

7075
ifneq ($(SASS_LIBSASS_PATH),)
71-
CFLAGS += -I $(SASS_LIBSASS_PATH)
72-
CXXFLAGS += -I $(SASS_LIBSASS_PATH)
76+
CFLAGS += -I $(SASS_LIBSASS_PATH)/include
77+
CXXFLAGS += -I $(SASS_LIBSASS_PATH)/include
78+
else
79+
# this is needed for mingw
80+
CFLAGS += -I include
81+
CXXFLAGS += -I include
7382
endif
7483

7584
ifneq ($(EXTRA_CFLAGS),)
@@ -152,75 +161,36 @@ ifeq (Windows,$(UNAME))
152161
SASSC_BIN = $(SASS_SASSC_PATH)/bin/sassc.exe
153162
endif
154163

155-
SOURCES = \
156-
ast.cpp \
157-
base64vlq.cpp \
158-
bind.cpp \
159-
color_maps.cpp \
160-
constants.cpp \
161-
context.cpp \
162-
cssize.cpp \
163-
emitter.cpp \
164-
environment.cpp \
165-
error_handling.cpp \
166-
eval.cpp \
167-
expand.cpp \
168-
extend.cpp \
169-
file.cpp \
170-
functions.cpp \
171-
inspect.cpp \
172-
json.cpp \
173-
lexer.cpp \
174-
listize.cpp \
175-
memory_manager.cpp \
176-
node.cpp \
177-
output.cpp \
178-
parser.cpp \
179-
plugins.cpp \
180-
position.cpp \
181-
prelexer.cpp \
182-
remove_placeholders.cpp \
183-
sass.cpp \
184-
sass_util.cpp \
185-
sass_values.cpp \
186-
sass_context.cpp \
187-
sass_functions.cpp \
188-
sass_interface.cpp \
189-
sass2scss.cpp \
190-
source_map.cpp \
191-
to_c.cpp \
192-
to_string.cpp \
193-
to_value.cpp \
194-
units.cpp \
195-
utf8_string.cpp \
196-
values.cpp \
197-
util.cpp
198-
199-
CSOURCES = cencode.c
164+
include Makefile.conf
200165

201166
RESOURCES =
202-
203-
LIBRARIES = lib/libsass.so
204-
167+
STATICLIB = lib/libsass.a
168+
SHAREDLIB = lib/libsass.so
205169
ifeq (MinGW,$(UNAME))
170+
RESOURCES += res/resource.rc
171+
SHAREDLIB = lib/libsass.dll
206172
ifeq (shared,$(BUILD))
207173
CFLAGS += -D ADD_EXPORTS
208174
CXXFLAGS += -D ADD_EXPORTS
209-
LIBRARIES += lib/libsass.dll
210-
RESOURCES += res/resource.rc
211175
endif
212176
else
213177
CFLAGS += -fPIC
214178
CXXFLAGS += -fPIC
215179
LDFLAGS += -fPIC
216180
endif
217181

218-
OBJECTS = $(SOURCES:.cpp=.o)
219-
COBJECTS = $(CSOURCES:.c=.o)
182+
OBJECTS = $(addprefix src/,$(SOURCES:.cpp=.o))
183+
COBJECTS = $(addprefix src/,$(CSOURCES:.c=.o))
220184
RCOBJECTS = $(RESOURCES:.rc=.o)
221185

222186
DEBUG_LVL ?= NONE
223187

188+
CLEANUPS ?=
189+
CLEANUPS += $(RCOBJECTS)
190+
CLEANUPS += $(COBJECTS)
191+
CLEANUPS += $(OBJECTS)
192+
CLEANUPS += $(LIBSASS_LIB)
193+
224194
all: $(BUILD)
225195

226196
debug: $(BUILD)
@@ -235,9 +205,6 @@ debug-shared: CFLAGS := -g -DDEBUG -DDEBUG_LVL="$(DEBUG_LVL)" $(filter-out -O2,$
235205
debug-shared: CXXFLAGS := -g -DDEBUG -DDEBUG_LVL="$(DEBUG_LVL)" $(filter-out -O2,$(CXXFLAGS))
236206
debug-shared: shared
237207

238-
static: lib/libsass.a
239-
shared: $(LIBRARIES)
240-
241208
lib:
242209
$(MKDIR) lib
243210

@@ -264,11 +231,44 @@ lib/libsass.dll: lib $(COBJECTS) $(OBJECTS) $(RCOBJECTS)
264231

265232
install: install-$(BUILD)
266233

267-
install-static: lib/libsass.a
268-
install -pm0755 $< $(DESTDIR)$(PREFIX)/$<
234+
static: $(STATICLIB)
235+
shared: $(SHAREDLIB)
236+
237+
$(DESTDIR)$(PREFIX):
238+
$(MKDIR) $(DESTDIR)$(PREFIX)
239+
240+
$(DESTDIR)$(PREFIX)/lib: $(DESTDIR)$(PREFIX)
241+
$(MKDIR) $(DESTDIR)$(PREFIX)/lib
242+
243+
$(DESTDIR)$(PREFIX)/include: $(DESTDIR)$(PREFIX)
244+
$(MKDIR) $(DESTDIR)$(PREFIX)/include
245+
246+
$(DESTDIR)$(PREFIX)/include/%.h: include/%.h
247+
$(INSTALL) -D -v -m0644 "$<" "$@"
248+
249+
install-headers: $(DESTDIR)$(PREFIX)/include/sass.h \
250+
$(DESTDIR)$(PREFIX)/include/sass2scss.h \
251+
$(DESTDIR)$(PREFIX)/include/sass_values.h \
252+
$(DESTDIR)$(PREFIX)/include/sass_version.h \
253+
$(DESTDIR)$(PREFIX)/include/sass_context.h \
254+
$(DESTDIR)$(PREFIX)/include/sass_functions.h
255+
256+
$(DESTDIR)$(PREFIX)/lib/%.a: lib/%.a \
257+
$(DESTDIR)$(PREFIX)/lib
258+
@$(INSTALL) -D -v -m0755 "$<" "$@"
259+
260+
$(DESTDIR)$(PREFIX)/lib/%.so: lib/%.so \
261+
$(DESTDIR)$(PREFIX)/lib
262+
@$(INSTALL) -D -v -m0755 "$<" "$@"
263+
264+
$(DESTDIR)$(PREFIX)/lib/%.dll: lib/%.dll \
265+
$(DESTDIR)$(PREFIX)/lib
266+
@$(INSTALL) -D -v -m0755 "$<" "$@"
267+
268+
install-static: $(DESTDIR)$(PREFIX)/lib/libsass.a
269269

270-
install-shared: lib/libsass.so
271-
install -pm0755 $< $(DESTDIR)$(PREFIX)/$<
270+
install-shared: $(DESTDIR)$(PREFIX)/lib/libsass.so \
271+
install-headers
272272

273273
$(SASSC_BIN): $(BUILD)
274274
$(MAKE) -C $(SASS_SASSC_PATH)
@@ -289,8 +289,10 @@ test_build: $(SASSC_BIN)
289289
test_issues: $(SASSC_BIN)
290290
$(RUBY_BIN) $(SASS_SPEC_PATH)/sass-spec.rb -c $(SASSC_BIN) $(LOG_FLAGS) $(SASS_SPEC_PATH)/spec/issues
291291

292-
clean:
293-
$(RM) $(RCOBJECTS) $(COBJECTS) $(OBJECTS) $(LIBRARIES) lib/*.a lib/*.so lib/*.dll lib/*.la
292+
clean-objects:
293+
$(RM) lib/*.a lib/*.so lib/*.dll lib/*.la
294+
clean: clean-objects
295+
$(RM) $(CLEANUPS)
294296

295297
clean-all:
296298
$(MAKE) -C $(SASS_SASSC_PATH) clean
@@ -308,7 +310,8 @@ lib-opts-shared:
308310
@echo -L"$(SASS_LIBSASS_PATH)/lib -lsass"
309311

310312
.PHONY: all static shared sassc \
311-
version clean clean-all \
313+
version install-headers \
314+
clean clean-all clean-objects \
312315
debug debug-static debug-shared \
313316
install install-static install-shared \
314317
lib-opts lib-opts-shared lib-opts-static \

Makefile.am

Lines changed: 19 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ACLOCAL_AMFLAGS = -I m4
1+
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 -I script
22

33
AM_COPT = -Wall -O2
44
AM_COVLDFLAGS =
@@ -8,103 +8,40 @@ if ENABLE_COVERAGE
88
AM_COVLDFLAGS += -lgcov
99
endif
1010

11-
AM_CFLAGS = $(AM_COPT)
11+
AM_CPPFLAGS = -I$(top_srcdir)/include
12+
AM_CFLAGS = $(AM_COPT)
1213
AM_CXXFLAGS = $(AM_COPT)
13-
AM_LDFLAGS = $(AM_COPT) $(AM_COVLDFLAGS)
14+
AM_LDFLAGS = $(AM_COPT) $(AM_COVLDFLAGS)
1415

16+
# only needed to support old source tree
17+
# we have moved the files to src folder
18+
AM_CPPFLAGS += -I$(top_srcdir)
19+
20+
RESOURCES =
1521
if COMPILER_IS_MINGW32
22+
RESOURCES += res/libsass.rc
1623
AM_CXXFLAGS += -std=gnu++0x
1724
else
1825
AM_CXXFLAGS += -std=c++0x
1926
endif
2027

21-
EXTRA_DIST = \
22-
COPYING \
23-
INSTALL \
24-
LICENSE \
25-
Readme.md
26-
27-
pkgconfigdir = $(libdir)/pkgconfig
28-
pkgconfig_DATA = support/libsass.pc
29-
30-
lib_LTLIBRARIES = libsass.la
31-
32-
libsass_la_SOURCES = \
33-
ast_fwd_decl.hpp ast_def_macros.hpp \
34-
kwd_arg_macros.hpp \
35-
position.cpp position.hpp \
36-
operation.hpp \
37-
subset_map.hpp mapping.hpp \
38-
color_names.hpp backtrace.hpp \
39-
cencode.c b64/cencode.h b64/encode.h \
40-
token.hpp \
41-
paths.hpp debug.hpp \
42-
utf8.h utf8/core.h \
43-
utf8/checked.h utf8/unchecked.h \
44-
ast.cpp ast.hpp \
45-
base64vlq.cpp base64vlq.hpp \
46-
bind.cpp bind.hpp \
47-
color_maps.cpp color_maps.hpp \
48-
constants.cpp constants.hpp \
49-
context.cpp context.hpp \
50-
environment.cpp environment.hpp \
51-
error_handling.cpp error_handling.hpp \
52-
eval.cpp eval.hpp \
53-
expand.cpp expand.hpp \
54-
extend.cpp extend.hpp \
55-
cssize.cpp cssize.hpp \
56-
listize.cpp listize.hpp \
57-
file.cpp file.hpp \
58-
functions.cpp functions.hpp \
59-
inspect.cpp inspect.hpp \
60-
lexer.cpp lexer.hpp \
61-
memory_manager.cpp memory_manager.hpp \
62-
node.cpp node.hpp \
63-
json.cpp json.hpp \
64-
emitter.cpp emitter.hpp \
65-
output.cpp output.hpp \
66-
parser.cpp parser.hpp \
67-
plugins.cpp plugins.hpp \
68-
prelexer.cpp prelexer.hpp \
69-
remove_placeholders.cpp remove_placeholders.hpp \
70-
sass.cpp sass.h \
71-
sass_util.cpp sass_util.hpp \
72-
sass_values.cpp sass_values.h \
73-
sass_context.cpp sass_context.h \
74-
sass_functions.cpp sass_functions.h \
75-
sass_interface.cpp sass_interface.h \
76-
sass2scss.cpp sass2scss.h \
77-
source_map.cpp source_map.hpp \
78-
to_c.cpp to_c.hpp \
79-
to_string.cpp to_string.hpp \
80-
to_value.cpp to_value.hpp \
81-
units.cpp units.hpp \
82-
utf8_string.cpp utf8_string.hpp \
83-
values.cpp values.hpp \
84-
util.cpp util.hpp
85-
86-
libsass_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 0:9:0
87-
88-
include_HEADERS = sass2scss.h sass_context.h sass_functions.h sass_values.h sass.h sass_version.h
89-
9028
if ENABLE_TESTS
9129

9230
noinst_PROGRAMS = tester
9331

94-
tester_LDADD = libsass.la
32+
tester_LDADD = src/libsass.la
9533
tester_SOURCES = $(SASS_SASSC_PATH)/sassc.c
96-
SASSC_VERSION=`cd "$(SASS_SASSC_PATH)" && ./version.sh`
97-
tester_CFLAGS = $(AM_CFLAGS) -DSASSC_VERSION="\"$(SASSC_VERSION)\""
98-
tester_CXXFLAGS = $(AM_CXXFLAGS) -DSASSC_VERSION="\"$(SASSC_VERSION)\""
99-
tester_LDFLAGS = $(AM_LDFLAGS) -no-install
34+
tester_VERSION ?= `cd "$(SASS_SASSC_PATH)" && ./version.sh`
35+
tester_CFLAGS = $(AM_CFLAGS) -DSASSC_VERSION="\"$(tester_VERSION)\""
36+
tester_CXXFLAGS = $(AM_CXXFLAGS) -DSASSC_VERSION="\"$(tester_VERSION)\""
37+
tester_LDFLAGS = $(AM_LDFLAGS)
10038

10139
if ENABLE_COVERAGE
10240
nodist_EXTRA_tester_SOURCES = non-existent-file-to-force-CXX-linking.cxx
103-
nodist_EXTRA_libsass_la_SOURCES = non-existent-file-to-force-CXX-linking.cxx
10441
endif
10542

106-
SASS_SASSC_PATH ?= sassc
107-
SASS_SPEC_PATH ?= sass-spec
43+
SASS_SASSC_PATH ?= $(top_srcdir)/sassc
44+
SASS_SPEC_PATH ?= $(top_srcdir)/sass-spec
10845

10946
TESTS = \
11047
$(SASS_SPEC_PATH)/spec/basic \
@@ -147,3 +84,5 @@ test_issues:
14784
$(SASS_TESTER) $(LOG_FLAGS) $(SASS_SPEC_PATH)/spec/issues $(SASS_TEST_FLAGS)
14885

14986
endif
87+
88+
SUBDIRS = src

0 commit comments

Comments
 (0)