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.

116 lines
1.9 KiB

  1. diff --git a/Makefile b/Makefile
  2. index a3f345f..fe5a083 100644
  3. --- a/Makefile
  4. +++ b/Makefile
  5. @@ -1,17 +1,16 @@
  6. -PREFIX=/usr/local
  7. -BINDIR=$(DESTDIR)$(PREFIX)/bin
  8. -CFLAGS=-Wall -Werror\
  9. - -Wformat=2\
  10. - -g\
  11. -
  12. -LDFLAGS=
  13. -OS=$(shell uname|tr A-Z a-z)
  14. -INSTALL=install
  15. -
  16. -VERS=$(shell ./vers.sh)
  17. -TARG=beanstalkd
  18. -MOFILE=main.o
  19. -OFILES=\
  20. +PREFIX ?= /usr/local
  21. +BINDIR = $(DESTDIR)$(PREFIX)/bin
  22. +CFLAGS += -Wall -Werror -Wformat=2 -g
  23. +LDFLAGS +=
  24. +LDLIBS ?=
  25. +
  26. +OS ?= $(shell uname | tr 'A-Z' 'a-z')
  27. +INSTALL ?= install
  28. +
  29. +VERS = $(shell ./vers.sh)
  30. +TARG = beanstalkd
  31. +MOFILE = main.o
  32. +OFILES = \
  33. $(OS).o\
  34. conn.o\
  35. file.o\
  36. @@ -29,52 +28,44 @@ OFILES=\
  37. vers.o\
  38. walg.o\
  39. -TOFILES=\
  40. +TOFILES = \
  41. testheap.o\
  42. testjobs.o\
  43. testserv.o\
  44. testutil.o\
  45. -HFILES=\
  46. +HFILES = \
  47. dat.h\
  48. sd-daemon.h\
  49. ifeq ($(OS),linux)
  50. -
  51. -LDLIBS=\
  52. - -lrt\
  53. -
  54. + LDLIBS += -lrt
  55. endif
  56. -CLEANFILES=\
  57. +CLEANFILES = \
  58. vers.c\
  59. -.PHONY: all
  60. all: $(TARG)
  61. $(TARG): $(OFILES) $(MOFILE)
  62. $(LINK.o) -o $@ $^ $(LDLIBS)
  63. -.PHONY: install
  64. install: $(BINDIR)/$(TARG)
  65. $(BINDIR)/%: %
  66. $(INSTALL) -d $(dir $@)
  67. $(INSTALL) $< $@
  68. -CLEANFILES:=$(CLEANFILES) $(TARG)
  69. +CLEANFILES := $(CLEANFILES) $(TARG)
  70. $(OFILES) $(MOFILE): $(HFILES)
  71. -.PHONY: clean
  72. clean:
  73. rm -f *.o $(CLEANFILES)
  74. -.PHONY: check
  75. check: ct/_ctcheck
  76. ct/_ctcheck
  77. -.PHONY: bench
  78. bench: ct/_ctcheck
  79. ct/_ctcheck -b
  80. @@ -88,11 +79,8 @@ ct/ct.o ct/_ctcheck.o: ct/ct.h ct/internal.h
  81. $(TOFILES): $(HFILES) ct/ct.h
  82. -CLEANFILES:=$(CLEANFILES) ct/_* ct/*.o
  83. +CLEANFILES += ct/_* ct/*.o
  84. -ifneq ($(shell ./verc.sh),$(shell cat vers.c 2>/dev/null))
  85. -.PHONY: vers.c
  86. -endif
  87. vers.c:
  88. ./verc.sh >vers.c
  89. @@ -100,3 +88,9 @@ doc/beanstalkd.1 doc/beanstalkd.1.html: doc/beanstalkd.ronn
  90. ronn $<
  91. freebsd.o: darwin.c
  92. +
  93. +.PHONY: all install clean check bench
  94. +
  95. +ifneq ($(shell ./verc.sh),$(shell cat vers.c 2>/dev/null))
  96. +.PHONY: vers.c
  97. +endif