update Makefile to process subdirs and have a clean target
authorBdale Garbee <bdale@gag.com>
Mon, 18 Mar 2013 21:05:41 +0000 (15:05 -0600)
committerBdale Garbee <bdale@gag.com>
Mon, 18 Mar 2013 21:05:41 +0000 (15:05 -0600)
packages/Makefile

index 55f374a732d11b92e2a914c870fe39db59d20bed..74ae8d051aad34146a86746fae4da230dd25e93b 100644 (file)
@@ -1,5 +1,9 @@
 .SUFFIXES: .5c .py .fp
 
+DIRS= \
+       pinheader \
+       tyco
+
 FOOTPRINTS= \
        MS5607.fp \
        uson-8.fp \
@@ -14,4 +18,20 @@ FOOTPRINTS= \
 .py.fp:
        python $*.py > $@
 
-all: $(FOOTPRINTS)
\ No newline at end of file
+BUILDDIRS=$(DIRS:%=build-%)
+CLEANDIRS=$(DIRS:%=clean-%)
+
+all: $(BUILDDIRS) $(FOOTPRINTS)
+$(DIRS): $(BUILDDIRS) 
+$(BUILDDIRS): 
+       $(MAKE) -C $(@:build-%=%)
+
+$(CLEANDIRS):
+       $(MAKE) -C $(@:clean-%=%) clean
+
+clean: $(CLEANDIRS)
+       rm -f $(FOOTPRINTS)
+
+.PHONY: subdirs $(DIRS)
+.PHONY: subdirs $(BUILDDIRS)
+.PHONY: subdirs $(CLEANDIRS)