Browse Source

enhance Makefile

pull/36/head 1.1.0
Antonio SJ Musumeci 11 years ago
parent
commit
a7d9a9bf61
  1. 21
      Makefile

21
Makefile

@ -20,6 +20,17 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
XATTR_AVAILABLE = $(shell test ! -e /usr/include/attr/xattr.h; echo $$?)
FUSE_AVAILABLE = $(shell ! pkg-config --exists fuse; echo $$?)
ifeq ($(FUSE_AVAILABLE),0)
FUSE_AVAILABLE = $(shell test ! -e /usr/include/fuse.h; echo $$?)
endif
ifeq ($(FUSE_AVAILABLE),0)
$(error "FUSE development package doesn't appear available")
endif
SRC = $(wildcard src/*.cpp) SRC = $(wildcard src/*.cpp)
OBJ = $(SRC:src/%.cpp=obj/%.o) OBJ = $(SRC:src/%.cpp=obj/%.o)
DEPS = $(OBJ:obj/%.o=obj/%.d) DEPS = $(OBJ:obj/%.o=obj/%.d)
@ -28,28 +39,28 @@ CFLAGS = -g -Wall \
$(shell pkg-config fuse --cflags) \ $(shell pkg-config fuse --cflags) \
-DFUSE_USE_VERSION=26 \ -DFUSE_USE_VERSION=26 \
-MMD -MMD
LDFLAGS = $(shell pkg-config fuse --libs)
ifdef WITHOUT_XATTR
ifeq ($(XATTR_AVAILABLE),0)
CFLAGS += -DWITHOUT_XATTR CFLAGS += -DWITHOUT_XATTR
endif endif
LDFLAGS = $(shell pkg-config fuse --libs)
all: $(TARGET) all: $(TARGET)
help: help:
@echo usage: make @echo usage: make
@echo make WITHOUT_XATTR=1 - to build program without xattrs functionality
@echo make XATTR_AVAILABLE=0 - to build program without xattrs functionality (auto discovered otherwise)
$(TARGET): obj/obj-stamp $(OBJ) $(TARGET): obj/obj-stamp $(OBJ)
g++ $(CFLAGS) $(OBJ) -o $@ $(LDFLAGS)
$(CXX) $(CFLAGS) $(OBJ) -o $@ $(LDFLAGS)
obj/obj-stamp: obj/obj-stamp:
mkdir -p obj mkdir -p obj
touch $@ touch $@
obj/%.o: src/%.cpp obj/%.o: src/%.cpp
g++ $(CFLAGS) -c $< -o $@
$(CXX) $(CFLAGS) -c $< -o $@
clean: clean:
rm -rf obj "$(TARGET)" rm -rf obj "$(TARGET)"

Loading…
Cancel
Save