2023-02-24 20:44:07 +01:00
|
|
|
VERSION = 1.2.5
|
2019-01-25 03:06:23 +01:00
|
|
|
|
2021-09-03 13:40:35 +02:00
|
|
|
CFLAGS += -g -O2 -Wall -Wextra -Wshadow \
|
2023-02-23 02:44:18 +01:00
|
|
|
-fanalyzer -Wno-analyzer-file-leak \
|
2021-09-01 13:34:53 +02:00
|
|
|
-rdynamic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\"\
|
2019-10-22 21:26:21 +02:00
|
|
|
`pkg-config --cflags-only-I gumbo libcurl fuse uuid expat`
|
2019-11-01 05:40:39 +01:00
|
|
|
LDFLAGS += `pkg-config --libs-only-L gumbo libcurl fuse uuid expat`
|
2021-05-27 20:49:51 +02:00
|
|
|
LIBS = -pthread -lgumbo -lcurl -lfuse -lcrypto -lexpat
|
2021-08-22 01:51:37 +02:00
|
|
|
COBJS = main.o network.o fuse_local.o link.o cache.o util.o sonic.o log.o\
|
2021-09-04 13:40:37 +02:00
|
|
|
config.o memcache.o
|
2018-07-18 17:26:26 +02:00
|
|
|
|
2019-11-01 05:40:39 +01:00
|
|
|
OS := $(shell uname)
|
2021-05-27 20:49:51 +02:00
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
BREW_PREFIX := $(shell brew --prefix)
|
|
|
|
CFLAGS += -I$(BREW_PREFIX)/opt/openssl/include \
|
|
|
|
-I$(BREW_PREFIX)/opt/curl/include
|
|
|
|
LDFLAGS += -L$(BREW_PREFIX)/opt/openssl/lib \
|
|
|
|
-L$(BREW_PREFIX)/opt/curl/lib
|
|
|
|
else
|
|
|
|
LIBS += -luuid
|
|
|
|
endif
|
2019-11-01 05:40:39 +01:00
|
|
|
ifeq ($(OS),FreeBSD)
|
|
|
|
LIBS += -lexecinfo
|
|
|
|
endif
|
|
|
|
|
2019-01-25 03:14:14 +01:00
|
|
|
prefix ?= /usr/local
|
2019-01-23 04:30:05 +01:00
|
|
|
|
2021-08-31 19:49:49 +02:00
|
|
|
all: httpdirfs
|
2019-01-25 03:19:22 +01:00
|
|
|
|
2019-01-25 03:36:15 +01:00
|
|
|
%.o: src/%.c
|
2019-01-25 03:17:19 +01:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c -o $@ $<
|
2018-07-18 17:26:26 +02:00
|
|
|
|
2019-01-25 03:19:58 +01:00
|
|
|
httpdirfs: $(COBJS)
|
2019-09-10 03:04:11 +02:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
2018-07-18 17:26:26 +02:00
|
|
|
|
2018-07-24 15:33:03 +02:00
|
|
|
install:
|
2019-11-01 05:40:39 +01:00
|
|
|
ifeq ($(OS),Linux)
|
2019-01-25 03:16:23 +01:00
|
|
|
install -m 755 -D httpdirfs \
|
|
|
|
$(DESTDIR)$(prefix)/bin/httpdirfs
|
2019-01-25 03:40:25 +01:00
|
|
|
install -m 644 -D doc/man/httpdirfs.1 \
|
2019-01-25 03:16:23 +01:00
|
|
|
$(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1
|
2019-11-01 05:40:39 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(OS),FreeBSD)
|
|
|
|
install -m 755 httpdirfs \
|
|
|
|
$(DESTDIR)$(prefix)/bin/httpdirfs
|
|
|
|
gzip -f -k doc/man/httpdirfs.1
|
|
|
|
install -m 644 doc/man/httpdirfs.1.gz \
|
|
|
|
$(DESTDIR)$(prefix)/man/man1/httpdirfs.1.gz
|
|
|
|
endif
|
2021-05-27 21:38:22 +02:00
|
|
|
ifeq ($(OS),Darwin)
|
2021-05-27 21:59:18 +02:00
|
|
|
install -d $(DESTDIR)$(prefix)/bin
|
2021-05-27 21:38:22 +02:00
|
|
|
install -m 755 httpdirfs \
|
|
|
|
$(DESTDIR)$(prefix)/bin/httpdirfs
|
|
|
|
install -d $(DESTDIR)$(prefix)/share/man/man1
|
|
|
|
install -m 644 doc/man/httpdirfs.1 \
|
|
|
|
$(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1
|
|
|
|
endif
|
2018-07-24 15:33:03 +02:00
|
|
|
|
2021-08-31 16:39:13 +02:00
|
|
|
man: httpdirfs
|
2022-04-22 18:32:47 +02:00
|
|
|
mkdir -p doc/man
|
2022-04-24 06:27:12 +02:00
|
|
|
help2man --name "mount HTTP directory as a virtual filesystem" \
|
|
|
|
--no-discard-stderr ./httpdirfs > doc/man/httpdirfs.1
|
2021-08-31 13:23:43 +02:00
|
|
|
|
2018-07-24 19:05:22 +02:00
|
|
|
doc:
|
|
|
|
doxygen Doxyfile
|
|
|
|
|
2021-08-31 19:49:49 +02:00
|
|
|
format:
|
2021-09-03 16:41:22 +02:00
|
|
|
astyle --style=kr --align-pointer=name --max-code-length=80 src/*.c src/*.h
|
2021-08-31 19:49:49 +02:00
|
|
|
|
2018-07-18 17:26:26 +02:00
|
|
|
clean:
|
2021-08-31 19:55:56 +02:00
|
|
|
-rm -f src/*.h~
|
|
|
|
-rm -f src/*.c~
|
2021-09-03 15:56:11 +02:00
|
|
|
-rm -f src/*orig
|
2019-01-25 03:40:25 +01:00
|
|
|
-rm -f *.o
|
|
|
|
-rm -f httpdirfs
|
2019-01-25 03:19:22 +01:00
|
|
|
|
|
|
|
distclean: clean
|
2021-08-31 13:23:43 +02:00
|
|
|
-rm -rf doc/html
|
2021-08-31 19:49:49 +02:00
|
|
|
-rm -rf doc/man/httpdirfs.1
|
2019-01-25 03:19:22 +01:00
|
|
|
|
2019-01-25 03:21:18 +01:00
|
|
|
uninstall:
|
|
|
|
-rm -f $(DESTDIR)$(prefix)/bin/httpdirfs
|
2019-11-01 05:40:39 +01:00
|
|
|
ifeq ($(OS),Linux)
|
2019-01-25 03:21:18 +01:00
|
|
|
-rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1
|
2019-11-01 05:40:39 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(OS),FreeBSD)
|
|
|
|
-rm -f $(DESTDIR)$(prefix)/man/man1/httpdirfs.1.gz
|
|
|
|
endif
|
2021-06-05 10:07:46 +02:00
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
-rm -f $(DESTDIR)$(prefix)/share/man/man1/httpdirfs.1
|
|
|
|
endif
|
2019-01-25 03:21:18 +01:00
|
|
|
|
2019-09-02 18:56:23 +02:00
|
|
|
depend: .depend
|
|
|
|
.depend: src/*.c
|
|
|
|
rm -f ./.depend
|
|
|
|
$(CC) $(CFLAGS) -MM $^ -MF ./.depend;
|
|
|
|
include .depend
|
|
|
|
|
2021-08-31 19:49:49 +02:00
|
|
|
.PHONY: all man doc install clean distclean uninstall depend format
|