File: Makefile

package info (click to toggle)
mmc-utils 1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 532 kB
  • sloc: ansic: 6,989; makefile: 71; python: 10
file content (65 lines) | stat: -rw-r--r-- 1,364 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
CC ?= gcc
GIT_VERSION ?= "$(shell git describe --abbrev=6 --always --tags)"
AM_CFLAGS = -D_FILE_OFFSET_BITS=64 \
	    -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
ifeq "$(C)" "1"
	check = sparse $(CHECKFLAGS) $(AM_CFLAGS)
endif

all: $(progs)

.c.o:
ifeq "$(C)" "1"
	$(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