2020-01-17 23:26:41 +01:00
|
|
|
TARGETS=twiboot mpmboot funkboot eprom_prog butterfly_prog
|
2014-12-26 11:48:18 +01:00
|
|
|
TARGET_DIR=~/bin
|
|
|
|
BUILD_DIR = build
|
2014-12-26 11:36:32 +01:00
|
|
|
|
2019-08-11 11:16:26 +02:00
|
|
|
CFLAGS= -pipe -O2 -Wall -Wextra -Wno-unused-result
|
2014-12-26 11:48:18 +01:00
|
|
|
CFLAGS+= -MMD -MP -MF $(BUILD_DIR)/$(*D)/$(*F).d
|
|
|
|
LDFLAGS=
|
2014-12-26 11:36:32 +01:00
|
|
|
|
|
|
|
# ------
|
|
|
|
|
2014-12-26 11:48:18 +01:00
|
|
|
SRC:= $(wildcard *.c)
|
2014-12-26 11:36:32 +01:00
|
|
|
|
2014-12-26 11:48:18 +01:00
|
|
|
all: $(TARGETS)
|
2014-12-26 11:36:32 +01:00
|
|
|
|
2014-12-26 11:48:18 +01:00
|
|
|
$(TARGETS): $(patsubst %,$(BUILD_DIR)/%, $(SRC:.c=.o))
|
2014-12-26 11:36:32 +01:00
|
|
|
@echo " Linking file: $@"
|
|
|
|
@$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) > /dev/null
|
|
|
|
|
2014-12-26 11:48:18 +01:00
|
|
|
$(BUILD_DIR)/%.o: %.c $(MAKEFILE_LIST)
|
2014-12-26 11:36:32 +01:00
|
|
|
@echo " Building file: $<"
|
2014-12-26 11:48:18 +01:00
|
|
|
@$(shell test -d $(BUILD_DIR)/$(*D) || mkdir -p $(BUILD_DIR)/$(*D))
|
|
|
|
@$(CC) $(CFLAGS) -o $@ -c $<
|
2014-12-26 11:36:32 +01:00
|
|
|
|
|
|
|
clean:
|
2014-12-26 11:48:18 +01:00
|
|
|
rm -rf $(BUILD_DIR) $(TARGETS)
|
2014-12-26 11:36:32 +01:00
|
|
|
|
2014-12-26 11:48:18 +01:00
|
|
|
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)
|