Broadcast forwarder for ip-bound gameservers
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.

49 lines
1.2 KiB

11 years ago
DESTDIR =
BINARY_DIR = /usr/local/bin
CONFIG_DIR = /usr/local/etc
LOG_DIR = /var/log
PID_DIR = /var/run
# ############################
11 years ago
SRC = $(wildcard *.c)
TARGET = bcastfwd
BUILD_DIR = build
CFLAGS = -O2 -g -pipe -Wall -Wno-unused-result
CFLAGS += -MMD -MF $(BUILD_DIR)/$(*D)/$(*F).d
LDFLAGS =
11 years ago
# ############################
ifeq ($(strip $(wildcard $(DESTDIR)$(CONFIG_DIR)/$(TARGET).conf)),)
NEWCONF=$(TARGET).conf
else
NEWCONF=$(TARGET).conf.dist
endif
# ############################
all: $(TARGET)
11 years ago
$(TARGET): $(patsubst %,$(BUILD_DIR)/%, $(SRC:.c=.o))
11 years ago
@echo " Linking file: $@"
@$(CC) $(LDFLAGS) $^ -o $@
11 years ago
$(BUILD_DIR)/%.o: %.c $(MAKEFILE_LIST)
11 years ago
@echo " Building file: $<"
11 years ago
@$(shell test -d $(BUILD_DIR)/$(*D) || mkdir -p $(BUILD_DIR)/$(*D))
11 years ago
@$(CC) $(CFLAGS) -o $@ -c $<
11 years ago
install: $(TARGET)
11 years ago
install -D -m 755 -s $(TARGET) $(DESTDIR)$(BINARY_DIR)/$(TARGET)
install -D -m 644 $(TARGET).conf $(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
sed -i -e "s:^logfile .*$$:logfile $(LOG_DIR)/$(TARGET).log:" \
-e "s:^pidfile .*$$:pidfile $(PID_DIR)/$(TARGET).pid:" \
$(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
install -d -m 755 $(DESTDIR)$(LOG_DIR)
clean:
11 years ago
rm -rf $(BUILD_DIR) $(TARGET)
11 years ago
11 years ago
include $(shell find $(BUILD_DIR) -name \*.d 2> /dev/null)