httpdirfs/Makefile.am
Jonathan Kamens 29c3eb8f67 Convert build process to use autotools (autoconf, automake, etc.)
This commit converts the build process from a hand-written Makefile
that works on Linux, FreeBSD, and macOS, to an automatically generated
Makefile managed by the autotools toolset.

This incldues:

* Add the compile, config.guess, config.sub, depcomp, install-sh, and
  missing helper scripts that autotools requires to be shipped with
  the package in order for configure to work.
* Rename Makefile to Makefile.am and restructure it for compatibility
  with autotools and specifically with the stuff in our configure
  script.
* Create the configure.ac source file which is turned into the
  configure script.
* Rename Doxyfile to Doxyfile.in so that the source directories can be
  substituted into it at configure time.
* Tweak .gitignore to ignore temporary and output files related to
  autotools.
* Generate Makefile.in, aclocal.m4, and configure using `autoreconf`
  and include them as checked-in source files.

While I can't fully document how autotools works here the basic
workflow is that when you need to make changes to the build, you
update Makefile.am and/or configure.ac as needed, run `autoreconf`,
and commit the changes you made as well as any resulting changes to
Makefile.in, aclocal.m4, and configure. Makefile should _not_ be
committed into the source tree; it should always be generated using
configure on the system where the build is being run.
2023-09-29 23:45:47 +01:00

37 lines
1.2 KiB
Makefile

bin_PROGRAMS = httpdirfs
httpdirfs_SOURCES = src/main.c src/network.c src/fuse_local.c src/link.c \
src/cache.c src/util.c src/sonic.c src/log.c src/config.c src/memcache.c
# This has $(fuse_LIBS) in it because there's a bug in the fuse pkgconf:
# it should add -pthread to CFLAGS but doesn't.
# $(NUCLA) is explained in configure.ac.
CFLAGS = -g -O2 -Wall -Wextra -Wshadow $(NUCLA) \
-rdynamic -D_GNU_SOURCE -DVERSION=\"$(VERSION)\"\
$(pkgconf_CFLAGS) $(fuse_CFLAGS) $(fuse_LIBS)
LIBS += $(pkgconf_LIBS) $(fuse_LIBS)
man_MANS = doc/man/httpdirfs.1
CLEANFILES = doc/man/*
DISTCLEANFILES = doc/html/*
# %.o: $(srcdir)/src/%.c
# $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c -o $@ $<
# httpdirfs: $(COBJS)
# $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
man: doc/man/httpdirfs.1
doc/man/httpdirfs.1: httpdirfs
mkdir -p doc/man
rm -f doc/man/httpdirfs.1.tmp
help2man --name "mount HTTP directory as a virtual filesystem" \
--no-discard-stderr ./httpdirfs > doc/man/httpdirfs.1.tmp
mv doc/man/httpdirfs.1.tmp doc/man/httpdirfs.1
doc:
doxygen Doxyfile
format:
astyle --style=kr --align-pointer=name --max-code-length=80 src/*.c src/*.h
.PHONY: man doc format