[BUILD] Added support for 'make install'

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)
This commit is contained in:
Christian Wiese 2008-03-12 15:25:35 +02:00 committed by Willy Tarreau
parent e4208cbc9d
commit a184aa273c
1 changed files with 14 additions and 0 deletions

View File

@ -38,6 +38,12 @@
# by "haproxy -vv" in CFLAGS. # by "haproxy -vv" in CFLAGS.
# SILENT_DEFINE may be used to specify other defines which will not be # SILENT_DEFINE may be used to specify other defines which will not be
# reported by "haproxy -vv". # 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 : # Other variables :
# DLMALLOC_SRC : build with dlmalloc, indicate the location of dlmalloc.c. # DLMALLOC_SRC : build with dlmalloc, indicate the location of dlmalloc.c.
@ -48,6 +54,10 @@
# SUBVERS : add a sub-version (eg: platform, model, ...). # SUBVERS : add a sub-version (eg: platform, model, ...).
# VERDATE : force haproxy's release date. # VERDATE : force haproxy's release date.
#### Installation options.
DESTDIR =
PREFIX = /usr/local
SBINDIR = $(PREFIX)/sbin
#### TARGET system #### TARGET system
# Use TARGET=<target_name> to optimize for a specifc target OS among the # Use TARGET=<target_name> to optimize for a specifc target OS among the
@ -462,6 +472,10 @@ src/haproxy.o: src/haproxy.c
src/dlmalloc.o: $(DLMALLOC_SRC) src/dlmalloc.o: $(DLMALLOC_SRC)
$(CC) $(COPTS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $< $(CC) $(COPTS) -DDEFAULT_MMAP_THRESHOLD=$(DLMALLOC_THRES) -c -o $@ $<
install: all
install -d $(DESTDIR)/$(SBINDIR)
install haproxy $(DESTDIR)/$(SBINDIR)
clean: clean:
rm -f *.[oas] src/*.[oas] core haproxy test rm -f *.[oas] src/*.[oas] core haproxy test
for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done for dir in . src include/* doc; do rm -f $$dir/*~ $$dir/*.rej;done