update makefile
This commit is contained in:
parent
6fd87d0ab0
commit
11c4892661
21
Makefile
21
Makefile
@ -6,10 +6,12 @@ PID_DIR = /var/run
|
|||||||
|
|
||||||
# ############################
|
# ############################
|
||||||
|
|
||||||
SRC := $(wildcard *.c)
|
SRC = $(wildcard *.c)
|
||||||
TARGET := bcastfwd
|
TARGET = bcastfwd
|
||||||
CFLAGS := -O2 -Wall -Wno-unused-result -MMD -I.
|
BUILD_DIR = build
|
||||||
LDFLAGS :=
|
CFLAGS = -O2 -g -pipe -Wall -Wno-unused-result
|
||||||
|
CFLAGS += -MMD -MF $(BUILD_DIR)/$(*D)/$(*F).d
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
# ############################
|
# ############################
|
||||||
|
|
||||||
@ -23,15 +25,16 @@ endif
|
|||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
$(TARGET): $(SRC:%.c=%.o)
|
$(TARGET): $(patsubst %,$(BUILD_DIR)/%, $(SRC:.c=.o))
|
||||||
@echo " Linking file: $@"
|
@echo " Linking file: $@"
|
||||||
@$(CC) $(LDFLAGS) $^ -o $@
|
@$(CC) $(LDFLAGS) $^ -o $@
|
||||||
|
|
||||||
%.o: %.c
|
$(BUILD_DIR)/%.o: %.c $(MAKEFILE_LIST)
|
||||||
@echo " Building file: $<"
|
@echo " Building file: $<"
|
||||||
|
@$(shell test -d $(BUILD_DIR)/$(*D) || mkdir -p $(BUILD_DIR)/$(*D))
|
||||||
@$(CC) $(CFLAGS) -o $@ -c $<
|
@$(CC) $(CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
install: all
|
install: $(TARGET)
|
||||||
install -D -m 755 -s $(TARGET) $(DESTDIR)$(BINARY_DIR)/$(TARGET)
|
install -D -m 755 -s $(TARGET) $(DESTDIR)$(BINARY_DIR)/$(TARGET)
|
||||||
install -D -m 644 $(TARGET).conf $(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
|
install -D -m 644 $(TARGET).conf $(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
|
||||||
sed -i -e "s:^logfile .*$$:logfile $(LOG_DIR)/$(TARGET).log:" \
|
sed -i -e "s:^logfile .*$$:logfile $(LOG_DIR)/$(TARGET).log:" \
|
||||||
@ -40,6 +43,6 @@ install: all
|
|||||||
install -d -m 755 $(DESTDIR)$(LOG_DIR)
|
install -d -m 755 $(DESTDIR)$(LOG_DIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.d *.o $(TARGET)
|
rm -rf $(BUILD_DIR) $(TARGET)
|
||||||
|
|
||||||
include $(shell find . -name \*.d 2> /dev/null)
|
include $(shell find $(BUILD_DIR) -name \*.d 2> /dev/null)
|
||||||
|
Loading…
Reference in New Issue
Block a user