Move Makefile logic from buildroot to repo

Every time we want to change how software from this repository is
built, we have to change the corresponding package in the buildroot/
repository, too. This is tedious because it involves changes to two
different repositories. Let's try to keep the .mk file in buildroot/
static and move Makefile logic closer to the actual source files.

Change-Id: I2820b3fcc2a424f473bd58622f1bb52277cef5bc
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..16b3c95
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+default: all
+
+DIRS=pfe_ctrl pfe_firmware
+
+all:     $(addsuffix /all,$(DIRS))
+clean:   $(addsuffix /clean,$(DIRS))
+install: $(addsuffix /install,$(DIRS))
+install-libs: $(addsuffix /install-libs,$(DIRS))
+
+install:
+	$(INSTALL) -m 0755 -D $(@D)/hotplug-script \
+		$(DESTDIR)/sbin/hotplug
+
+pfe_ctrl/all:
+	$(MAKE) -C $(@D) $(LINUX_MAKE_FLAGS) KERNELDIR=$(LINUX_DIR) PFE_DIR=../pfe
+
+pfe_ctrl/install:
+	$(MAKE) -C $(LINUX_DIR) $(LINUX_MAKE_FLAGS) M="$(@D)/pfe_ctrl" modules_install
+
+%/all:
+	$(MAKE) -C $* all
+
+%/test:
+	$(MAKE) -C $* test
+
+%/clean:
+	$(MAKE) -C $* clean
+
+%/install:
+	$(MAKE) -C $* install
diff --git a/pfe_firmware/Makefile b/pfe_firmware/Makefile
new file mode 100644
index 0000000..9bcd0a2
--- /dev/null
+++ b/pfe_firmware/Makefile
@@ -0,0 +1,13 @@
+all: ;
+test: ;
+clean: ;
+
+install:
+	$(INSTALL) -m 0755 -D $(@D)/class_c2000.elf \
+		$(DESTDIR)/lib/firmware/class_c2000.elf
+	$(INSTALL) -m 0755 -D $(@D)/tmu_c2000.elf \
+		$(DESTDIR)/lib/firmware/tmu_c2000.elf
+	$(INSTALL) -m 0755 -D $(@D)/util_c2000.elf \
+		$(DESTDIR)/lib/firmware/util_c2000.elf
+	$(INSTALL) -m 0755 -D $(@D)/util_c2000_revA0.elf \
+		$(DESTDIR)/lib/firmware/util_c2000_revA0.elf