]> git.kaiwu.me - haproxy.git/commitdiff
[BUILD] Added support for 'make install'
authorChristian Wiese <morfoh@opensde.org>
Wed, 12 Mar 2008 13:25:35 +0000 (15:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 17 Mar 2008 21:51:26 +0000 (22:51 +0100)
To be flexible while installing haproxy following variables have been
added to the Makefile:
- DESTDIR useful i.e. while installing in a sandbox (not set by default)
- PREFIX  defines the default install prefix (default: /usr/local)
- SBINDIR defines the dir the haproxy binary gets installed
  (default: $PREFIX/sbin)

Makefile

index 5624b1e496d5df89576f83234c6b05a5ca1504fb..ab56953cfa0dd8a88ca244d2d9ead9c39b0c82e9 100644 (file)
--- a/Makefile
+++ b/Makefile
 #          by "haproxy -vv" in CFLAGS.
 #   SILENT_DEFINE may be used to specify other defines which will not be
 #     reported by "haproxy -vv".
+#   DESTDIR is not set by default and is used for installation only.
+#           It might be useful to set DESTDIR if you want to install haproxy
+#           in a sandbox.
+#   PREFIX  is set to "/usr/local" by default and is used for installation only.
+#   SBINDIR is set to "$(PREFIX)/sbin" by default and is used for installation
+#           only.
 #
 # Other variables :
 #   DLMALLOC_SRC   : build with dlmalloc, indicate the location of dlmalloc.c.
 #   SUBVERS        : add a sub-version (eg: platform, model, ...).
 #   VERDATE        : force haproxy's release date.
 
+#### Installation options.
+DESTDIR =
+PREFIX = /usr/local
+SBINDIR = $(PREFIX)/sbin
 
 #### TARGET system
 # Use TARGET=<target_name> to optimize for a specifc target OS among the
@@ -435,6 +445,10 @@ src/haproxy.o:     src/haproxy.c
 src/dlmalloc.o: $(DLMALLOC_SRC)
        $(CC) $(COPTS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
 
+install: all
+       install -d $(DESTDIR)/$(SBINDIR)
+       install haproxy $(DESTDIR)/$(SBINDIR)
+
 clean:
        rm -f *.[oas] src/*.[oas] core haproxy test
        for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done