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.

37 lines
935 B

TARGETS=twiboot mpmboot funkboot eprom_prog butterfly_prog
BUILD_DIR = build
CFLAGS= -pipe -O2 -Wall -Wextra -Wno-unused-result
CFLAGS+= -MMD -MP -MF $(BUILD_DIR)/$(*D)/$(*F).d
# ------
SRC:= $(wildcard *.c)
all: $(TARGETS)
$(TARGETS): $(patsubst %,$(BUILD_DIR)/%, $(SRC:.c=.o))
@echo " Linking file: $@"
@$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) > /dev/null
@echo " Building file: $<"
@$(shell test -d $(BUILD_DIR)/$(*D) || mkdir -p $(BUILD_DIR)/$(*D))
@$(CC) $(CFLAGS) -o $@ -c $<
rm -rf $(BUILD_DIR) $(TARGETS)
install: $(TARGETS)
@mkdir -p $(TARGET_DIR)
rm -f $(patsubst %,$(TARGET_DIR)/%, $(TARGETS))
cp -a $^ $(TARGET_DIR)
install_links: $(TARGETS)
@mkdir -p $(TARGET_DIR)
rm -f $(patsubst %,$(TARGET_DIR)/%, $(TARGETS))
ln -s -t $(TARGET_DIR) $(patsubst %,$(PWD)/%, $(TARGETS))
-include $(shell find $(BUILD_DIR) -name \*.d 2> /dev/null)