Home | History | Annotate | Download | only in mmc-utils
      1 CC ?= gcc
      2 AM_CFLAGS = -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2
      3 CFLAGS ?= -g -O2
      4 objects = \
      5 	mmc.o \
      6 	mmc_cmds.o \
      7 	3rdparty/hmac_sha/hmac_sha2.o \
      8 	3rdparty/hmac_sha/sha2.o
      9 
     10 CHECKFLAGS = -Wall -Werror -Wuninitialized -Wundef
     11 
     12 DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
     13 
     14 override CFLAGS := $(CHECKFLAGS) $(AM_CFLAGS) $(CFLAGS)
     15 
     16 INSTALL = install
     17 prefix ?= /usr/local
     18 bindir = $(prefix)/bin
     19 LIBS=
     20 RESTORE_LIBS=
     21 
     22 progs = mmc
     23 
     24 # make C=1 to enable sparse
     25 ifdef C
     26 	check = sparse $(CHECKFLAGS)
     27 endif
     28 
     29 all: $(progs) manpages
     30 
     31 .c.o:
     32 ifdef C
     33 	$(check) $<
     34 endif
     35 	$(CC) $(CPPFLAGS) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
     36 
     37 mmc: $(objects)
     38 	$(CC) $(CFLAGS) -o $@ $(objects) $(LDFLAGS) $(LIBS)
     39 
     40 manpages:
     41 	$(MAKE) -C man
     42 
     43 install-man:
     44 	$(MAKE) -C man install
     45 
     46 clean:
     47 	rm -f $(progs) $(objects)
     48 	$(MAKE) -C man clean
     49 
     50 install: $(progs) install-man
     51 	$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
     52 	$(INSTALL) $(progs) $(DESTDIR)$(bindir)
     53 
     54 .PHONY: all clean install manpages install-man
     55