You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 935 B

12345678910111213141516171819202122232425262728293031323334353637
  1. TARGETS=twiboot mpmboot funkboot eprom_prog butterfly_prog
  2. TARGET_DIR=~/bin
  3. BUILD_DIR = build
  4. CFLAGS= -pipe -O2 -Wall -Wextra -Wno-unused-result
  5. CFLAGS+= -MMD -MP -MF $(BUILD_DIR)/$(*D)/$(*F).d
  6. LDFLAGS=
  7. # ------
  8. SRC:= $(wildcard *.c)
  9. all: $(TARGETS)
  10. $(TARGETS): $(patsubst %,$(BUILD_DIR)/%, $(SRC:.c=.o))
  11. @echo " Linking file: $@"
  12. @$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) > /dev/null
  13. $(BUILD_DIR)/%.o: %.c $(MAKEFILE_LIST)
  14. @echo " Building file: $<"
  15. @$(shell test -d $(BUILD_DIR)/$(*D) || mkdir -p $(BUILD_DIR)/$(*D))
  16. @$(CC) $(CFLAGS) -o $@ -c $<
  17. clean:
  18. rm -rf $(BUILD_DIR) $(TARGETS)
  19. install: $(TARGETS)
  20. @mkdir -p $(TARGET_DIR)
  21. rm -f $(patsubst %,$(TARGET_DIR)/%, $(TARGETS))
  22. cp -a $^ $(TARGET_DIR)
  23. install_links: $(TARGETS)
  24. @mkdir -p $(TARGET_DIR)
  25. rm -f $(patsubst %,$(TARGET_DIR)/%, $(TARGETS))
  26. ln -s -t $(TARGET_DIR) $(patsubst %,$(PWD)/%, $(TARGETS))
  27. -include $(shell find $(BUILD_DIR) -name \*.d 2> /dev/null)