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.

Makefile 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. DESTDIR =
  2. BINARY_DIR = /usr/local/bin
  3. CONFIG_DIR = /usr/local/etc
  4. LOG_DIR = /var/log
  5. PID_DIR = /var/run
  6. # ############################
  7. SRC = $(wildcard *.c)
  8. TARGET = bcastfwd
  9. BUILD_DIR = build
  10. CFLAGS = -O2 -g -pipe -Wall -Wno-unused-result
  11. CFLAGS += -MMD -MF $(BUILD_DIR)/$(*D)/$(*F).d
  12. LDFLAGS =
  13. # ############################
  14. ifeq ($(strip $(wildcard $(DESTDIR)$(CONFIG_DIR)/$(TARGET).conf)),)
  15. NEWCONF=$(TARGET).conf
  16. else
  17. NEWCONF=$(TARGET).conf.dist
  18. endif
  19. # ############################
  20. all: $(TARGET)
  21. $(TARGET): $(patsubst %,$(BUILD_DIR)/%, $(SRC:.c=.o))
  22. @echo " Linking file: $@"
  23. @$(CC) $(LDFLAGS) $^ -o $@
  24. $(BUILD_DIR)/%.o: %.c $(MAKEFILE_LIST)
  25. @echo " Building file: $<"
  26. @$(shell test -d $(BUILD_DIR)/$(*D) || mkdir -p $(BUILD_DIR)/$(*D))
  27. @$(CC) $(CFLAGS) -o $@ -c $<
  28. install: $(TARGET)
  29. install -D -m 755 -s $(TARGET) $(DESTDIR)$(BINARY_DIR)/$(TARGET)
  30. install -D -m 644 $(TARGET).conf $(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
  31. sed -i -e "s:^logfile .*$$:logfile $(LOG_DIR)/$(TARGET).log:" \
  32. -e "s:^pidfile .*$$:pidfile $(PID_DIR)/$(TARGET).pid:" \
  33. $(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
  34. install -d -m 755 $(DESTDIR)$(LOG_DIR)
  35. clean:
  36. rm -rf $(BUILD_DIR) $(TARGET)
  37. include $(shell find $(BUILD_DIR) -name \*.d 2> /dev/null)