--- /dev/null
+LIBDIRS = vector typing logic htable
+APPDIRS = socket-sniff tests
+
+default: $(LIBDIRS) $(APPDIRS)
+ for d in $^ ; do $(MAKE) -C $$d default ; done
+
+clean: $(LIBDIRS) $(APPDIRS)
+ for d in $^ ; do $(MAKE) -C $$d clean ; done
--- /dev/null
+BASEDIR := $(shell dirname $$(pwd))
+LIBDIRS = vector typing logic
+INCDIRS = $(addprefix -I$(BASEDIR)/,$(LIBDIRS))
+CFLAGS = -Wall -g -fmax-errors=1 -I. $(INCDIRS)
+LDLIBS = -lm
+
+%.h:
+ echo "#ifndef ${@:.h=_H}" > $@
+ echo "#define ${@:.h=_H}" >> $@
+ echo "#endif" >> $@
+
+define STDCC
+.INTERMEDIATE: $1.o
+CLEANRM += $1.o
+$1.o: $1.c | $1.h
+endef
+
+$(foreach OBJ,$(LIBOBJS:.o=),$(eval $(call STDCC,$(OBJ))))
+
+CLEANRM += $(LIBRARY)
+$(LIBRARY): $(LIBOBJS)
+ $(AR) r $@ $^
+
+clean:
+ rm -f $(CLEANRM)