]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Use pattern rule for compiling objects
authorKeith Busch <keith.busch@intel.com>
Wed, 8 Jun 2016 15:59:41 +0000 (09:59 -0600)
committerKeith Busch <keith.busch@intel.com>
Wed, 8 Jun 2016 16:40:58 +0000 (10:40 -0600)
All the object files had the same pattern, though some of the targets
were missing the correct dependency list. This fixes them all with a
pattern rule.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Makefile

index 41c644e1e1797b8e3dbf582abaf2917797fb9e0b..bf756f5b29392baf6c370d76c6a6beba46b04c11 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -36,26 +36,11 @@ OBJS := argconfig.o suffix.o parser.o nvme-print.o nvme-ioctl.o \
 nvme: nvme.c ./linux/nvme.h $(OBJS) NVME-VERSION-FILE
        $(CC) $(CPPFLAGS) $(CFLAGS) nvme.c $(LDFLAGS) -o $(NVME) $(OBJS)
 
-nvme-ioctl.o: nvme-ioctl.c nvme-ioctl.h
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c nvme-ioctl.c
+nvme.o: nvme.c nvme.h nvme-print.h nvme-ioctl.h argconfig.h suffix.h nvme-lightnvm.h fabrics.h
+       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
 
-fabrics.o: fabrics.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c fabrics.c
-
-parser.o: parser.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c parser.c
-
-argconfig.o: argconfig.c argconfig.h suffix.h
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c argconfig.c
-
-suffix.o: suffix.c suffix.h
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c suffix.c
-
-nvme-print.o: nvme-print.c nvme-print.h
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c nvme-print.c
-
-nvme-lightnvm.o: nvme-lightnvm.h nvme-lightnvm.h
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c nvme-lightnvm.c
+%.o: %.c %.h
+       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
 
 doc: $(NVME)
        $(MAKE) -C Documentation