mmc-utils/Makefile
Rudi Heitbaum 123fd8b2ac mmc-utils: create mandir during install
fixes install faikure when mandir is not already created

  install -m 644 mmc.1 /usr/share/man/man1
  install: cannot create regular file '/usr/share/man/man1': No such file or directory

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/ZpxwXEKy1bAOCes_@378c8c72e398
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-08-01 12:49:20 +02:00

66 lines
1.3 KiB
Makefile

CC ?= gcc
GIT_VERSION := "$(shell git describe --abbrev=6 --always --tags)"
AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 \
-DVERSION=\"$(GIT_VERSION)\"
CFLAGS ?= -g -O2
objects = \
mmc.o \
mmc_cmds.o \
lsmmc.o \
3rdparty/hmac_sha/hmac_sha2.o \
3rdparty/hmac_sha/sha2.o
CHECKFLAGS = -Wall -Werror -Wuninitialized -Wundef
DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
override CFLAGS := $(CHECKFLAGS) $(AM_CFLAGS) $(CFLAGS)
INSTALL = install
prefix ?= /usr/local
bindir = $(prefix)/bin
LIBS=
RESTORE_LIBS=
mandir = /usr/share/man
progs = mmc
# make C=1 to enable sparse - default
C ?= 1
ifdef C
check = sparse $(CHECKFLAGS) $(AM_CFLAGS)
endif
all: $(progs)
.c.o:
ifdef C
$(check) $<
endif
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
mmc: $(objects)
$(CC) $(CFLAGS) -o $@ $(objects) $(LDFLAGS) $(LIBS)
manpages:
$(MAKE) -C man
clean:
rm -f $(progs) $(objects)
$(MAKE) -C man clean
$(MAKE) -C docs clean
install: $(progs)
$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
$(INSTALL) $(progs) $(DESTDIR)$(bindir)
$(INSTALL) -m755 -d $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 644 mmc.1 $(DESTDIR)$(mandir)/man1
-include $(foreach obj,$(objects), $(dir $(obj))/.$(notdir $(obj)).d)
.PHONY: all clean install manpages install-man
# Add this new target for building HTML documentation using docs/Makefile
html-docs:
$(MAKE) -C docs html