Skip to content

Commit b70e8fb

Browse files
committed
Move sources into their own subdirectory
1 parent 14dba80 commit b70e8fb

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ endif
119119

120120
# Note: Doesn't work for paths with spaces in them
121121
SRC_DIR=$(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
122-
vpath %.cpp $(SRC_DIR)
122+
vpath %.cpp $(SRC_DIR)/src
123123

124124
PKG_CONFIG = pkg-config
125125
$(call ensure_binary,$(PKG_CONFIG))
@@ -140,10 +140,14 @@ else ifeq ($(OS),Linux)
140140
LFLAGS += -Wl,-rpath=$(shell $(PKG_CONFIG) fuse --variable=libdir)
141141
endif
142142

143-
FUSE_FLAGS := $(shell $(PKG_CONFIG) fuse --cflags --libs)
143+
FUSE_CFLAGS := $(shell $(PKG_CONFIG) fuse --cflags)
144+
FUSE_LDFLAGS := $(shell $(PKG_CONFIG) fuse --libs)
144145

145-
$(TARGET): sparsebundlefs.cpp
146-
$(CXX) $< -o $@ $(CFLAGS) $(FUSE_FLAGS) $(LFLAGS) $(DEFINES)
146+
%.o: %.cpp
147+
$(CXX) -c $< -o $@ $(CFLAGS) $(FUSE_CFLAGS) $(DEFINES)
148+
149+
$(TARGET): sparsebundlefs.o
150+
$(CXX) $< -o $@ $(LFLAGS) $(FUSE_LDFLAGS)
147151

148152
SPARSEBUNDLEFS=$(abspath $(TARGET))
149153
export SPARSEBUNDLEFS
@@ -166,12 +170,13 @@ $(TESTDATA_DIR):
166170
check_%: check ; @:
167171
check: $(TARGET) $(TESTDATA_DIR)
168172
@echo "============== $(PLATFORMS) =============="
169-
@$(SRC_DIR)/testrunner.sh $(TESTS_DIR)/*.sh \
173+
@$(SRC_DIR)/src/testrunner.sh $(TESTS_DIR)/*.sh \
170174
$(subst check_,test_,$(filter check_%,$(ACTUAL_GOALS)))
171175

172176
clean:
173177
rm -f $(TARGET)
174178
rm -Rf $(TARGET).dSYM
179+
rm -f *.o
175180

176181
distclean: clean
177182
rm -Rf $(TESTDATA_DIR)
File renamed without changes.

0 commit comments

Comments
 (0)