161177553619bdec11ddac133466ab9c733f45222Ben GardinerCC ?= gcc
280d2660fa95615f3bc77a9b258414f2c533175cGoffredo BaroncelliAM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
361177553619bdec11ddac133466ab9c733f45222Ben GardinerCFLAGS ?= -g -O2
435c31feacf9be6a76732910f564cedbd872512f8Roman Peniaevobjects = \
535c31feacf9be6a76732910f564cedbd872512f8Roman Peniaev	mmc.o \
635c31feacf9be6a76732910f564cedbd872512f8Roman Peniaev	mmc_cmds.o \
735c31feacf9be6a76732910f564cedbd872512f8Roman Peniaev	3rdparty/hmac_sha/hmac_sha2.o \
835c31feacf9be6a76732910f564cedbd872512f8Roman Peniaev	3rdparty/hmac_sha/sha2.o
980d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
1061177553619bdec11ddac133466ab9c733f45222Ben GardinerCHECKFLAGS = -Wall -Werror -Wuninitialized -Wundef
1180d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
1280d2660fa95615f3bc77a9b258414f2c533175cGoffredo BaroncelliDEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
1380d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
1461177553619bdec11ddac133466ab9c733f45222Ben Gardineroverride CFLAGS := $(CHECKFLAGS) $(AM_CFLAGS) $(CFLAGS)
1561177553619bdec11ddac133466ab9c733f45222Ben Gardiner
1680d2660fa95615f3bc77a9b258414f2c533175cGoffredo BaroncelliINSTALL = install
1780d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliprefix ?= /usr/local
1880d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncellibindir = $(prefix)/bin
1980d2660fa95615f3bc77a9b258414f2c533175cGoffredo BaroncelliLIBS=
2080d2660fa95615f3bc77a9b258414f2c533175cGoffredo BaroncelliRESTORE_LIBS=
2180d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
2280d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliprogs = mmc
2380d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
2480d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli# make C=1 to enable sparse
2580d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliifdef C
2680d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli	check = sparse $(CHECKFLAGS)
2780d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliendif
2880d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
2980d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliall: $(progs) manpages
3080d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
3180d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli.c.o:
3280d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliifdef C
3380d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli	$(check) $<
3480d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliendif
3535c31feacf9be6a76732910f564cedbd872512f8Roman Peniaev	$(CC) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
3680d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
3780d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncellimmc: $(objects)
3880d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli	$(CC) $(CFLAGS) -o $@ $(objects) $(LDFLAGS) $(LIBS)
3980d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
4080d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncellimanpages:
41a8276f539b27bee8868ecc210b987930c31a05e0Mike Frysinger	$(MAKE) -C man
4280d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
4380d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliinstall-man:
44a8276f539b27bee8868ecc210b987930c31a05e0Mike Frysinger	$(MAKE) -C man install
4580d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
4680d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliclean:
4780d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli	rm -f $(progs) $(objects)
48a8276f539b27bee8868ecc210b987930c31a05e0Mike Frysinger	$(MAKE) -C man clean
4980d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli
5080d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelliinstall: $(progs) install-man
5180d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli	$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
5280d2660fa95615f3bc77a9b258414f2c533175cGoffredo Baroncelli	$(INSTALL) $(progs) $(DESTDIR)$(bindir)
53a8276f539b27bee8868ecc210b987930c31a05e0Mike Frysinger
54a8276f539b27bee8868ecc210b987930c31a05e0Mike Frysinger.PHONY: all clean install manpages install-man
55