2013-05-31 05:12:44 +08:00
|
|
|
CC ?= gcc
|
2012-02-13 00:43:14 +08:00
|
|
|
AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
|
2013-05-31 05:12:44 +08:00
|
|
|
CFLAGS ?= -g -O2
|
2012-02-13 00:49:53 +08:00
|
|
|
objects = mmc.o mmc_cmds.o
|
2012-02-13 00:43:14 +08:00
|
|
|
|
2013-05-31 05:12:44 +08:00
|
|
|
CHECKFLAGS = -Wall -Werror -Wuninitialized -Wundef
|
2012-02-13 00:43:14 +08:00
|
|
|
|
|
|
|
DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
|
|
|
|
|
2013-05-31 05:12:44 +08:00
|
|
|
override CFLAGS := $(CHECKFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
|
|
|
|
2012-02-13 00:43:14 +08:00
|
|
|
INSTALL = install
|
|
|
|
prefix ?= /usr/local
|
|
|
|
bindir = $(prefix)/bin
|
|
|
|
LIBS=
|
|
|
|
RESTORE_LIBS=
|
|
|
|
|
|
|
|
progs = mmc
|
|
|
|
|
|
|
|
# make C=1 to enable sparse
|
|
|
|
ifdef C
|
|
|
|
check = sparse $(CHECKFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
all: $(progs) manpages
|
|
|
|
|
|
|
|
.c.o:
|
|
|
|
ifdef C
|
|
|
|
$(check) $<
|
|
|
|
endif
|
2013-05-31 05:12:44 +08:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -c $<
|
2012-02-13 00:43:14 +08:00
|
|
|
|
|
|
|
mmc: $(objects)
|
|
|
|
$(CC) $(CFLAGS) -o $@ $(objects) $(LDFLAGS) $(LIBS)
|
|
|
|
|
|
|
|
manpages:
|
2013-12-12 03:33:28 +08:00
|
|
|
$(MAKE) -C man
|
2012-02-13 00:43:14 +08:00
|
|
|
|
|
|
|
install-man:
|
2013-12-12 03:33:28 +08:00
|
|
|
$(MAKE) -C man install
|
2012-02-13 00:43:14 +08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(progs) $(objects)
|
2013-12-12 03:33:28 +08:00
|
|
|
$(MAKE) -C man clean
|
2012-02-13 00:43:14 +08:00
|
|
|
|
|
|
|
install: $(progs) install-man
|
|
|
|
$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
|
|
|
|
$(INSTALL) $(progs) $(DESTDIR)$(bindir)
|
2013-12-12 03:33:28 +08:00
|
|
|
|
|
|
|
.PHONY: all clean install manpages install-man
|