Makefile 989 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /=./
  2. include config.mk
  3. libdirs = crypto format netlink nlusctl string time util
  4. libpatt = lib/arch/$(ARCH)/*.o lib/*.o $(patsubst %,lib/%/*.o,$(libdirs))
  5. all: libs
  6. $(MAKE) bins
  7. libs: build-lib-arch build-lib $(patsubst %,build-lib-%,$(libdirs))
  8. $(MAKE) lib.a
  9. build-lib:
  10. $(MAKE) -C lib
  11. build-lib-arch:
  12. $(MAKE) -C lib/arch/$(ARCH)
  13. build-lib-%:
  14. $(MAKE) -C lib/$*
  15. lib.a: $(wildcard $(libpatt))
  16. ar crDT $@ $^
  17. build:
  18. $(MAKE) -C src
  19. bins:
  20. $(MAKE) -C src build
  21. clean: clean-lib clean-src clean-test clean-temp
  22. clean-lib:
  23. rm -f lib.a
  24. rm -f lib/*.o lib/*/*.o lib/arch/*/*.o
  25. rm -f lib/*.d lib/*/*.d lib/arch/*/*.d
  26. clean-src:
  27. $(MAKE) -C src clean
  28. clean-test:
  29. $(MAKE) -C test clean
  30. clean-temp:
  31. $(MAKE) -C temp clean
  32. test:
  33. $(MAKE) -C test run
  34. # Allow building files from the top dir
  35. # Useful for :make in vim
  36. src/%.o lib/%.o temp/%.o test/%.o:
  37. $(MAKE) -C $(dir $@) $(notdir $@)
  38. .PHONY: all build strip libs test
  39. .PHONY: clean clean-lib clean-src clean-temp clean-test