| # Copyright (C) 2000-2005 SWsoft. All rights reserved. |
| # |
| # This file may be distributed under the terms of the Q Public License |
| # as defined by Trolltech AS of Norway and appearing in the file |
| # LICENSE.QPL included in the packaging of this file. |
| # |
| # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| # |
| |
| INSTALL = install |
| PREFIX = /usr |
| SBINDIR = $(PREFIX)/sbin |
| LIBDIR = $(PREFIX)/lib/vzctl |
| CACHEDIR = /vz/template/cache |
| GLBCONFIG = /etc/sysconfig/vz |
| VPSCONFDIR = /etc/sysconfig/vz-scripts |
| DISTCONFDIR = $(VPSCONFDIR)/dists |
| NETSCRIPTDIR = /etc/sysconfig/network-scripts |
| CRONDDIR = /etc/cron.d |
| INITDDIR = /etc/init.d |
| VZLOCKDIR = /vz/lock |
| LOGRDIR = /etc/logrotate.d |
| LIB_VER = 0.0.1 |
| |
| export LD_LIBRARY_PATH=. |
| CC = gcc |
| CFLAGS = -Wall -g2 |
| SHAREDLIB_CFLAGS = -fPIC |
| VZKERNEL_HEADERS ?= /lib/modules/$(shell uname -r)/build/include |
| INC = -I ../include -I$(VZKERNEL_HEADERS) |
| ARCH=$(shell uname -i) |
| |
| OBJ_libvzctl = lib/env.lo lib/ub.lo lib/net.lo lib/logger.lo lib/exec.lo \ |
| lib/cap.lo lib/cpu.lo lib/res.lo lib/util.lo lib/dist.lo lib/list.lo \ |
| lib/script.lo lib/dev.lo lib/config.lo lib/lock.lo lib/quota.lo \ |
| lib/modules.lo lib/iptables.lo lib/fs.lo lib/create.lo lib/readelf.lo |
| OBJ_simfs=lib/fs_simfs.lo |
| OBJ_vzctl = vzctl.o vzctl-actions.o modules.o enter.o |
| OBJ_vzlist = vzlist.o |
| OBJ_arp = arpsend.o |
| OBJ_split = vzsplit.o |
| OBJ_memcheck = vzmemcheck.o validate.o |
| OBJ_cfgvalidate = vzcfgvalidate.o validate.o |
| OBJ_calc = vzcalc.o |
| OBJ = $(OBJ_vzctl) $(OBJ_vzlist) $(OBJ_arp) $(OBJ_split) $(OBJ_memcheck) \ |
| $(OBJ_cfgvalidate) $(OBJ_calc) |
| LOBJ = $(OBJ_libvzctl) $(OBJ_simfs) |
| LIB_vzctl = libvzctl.so.$(LIB_VER) |
| LIB_simfs = libvzctl-simfs.so.$(LIB_VER) |
| LIB_fs = libvzctl-fs.so |
| |
| LD_FLAGS = -L. -Wl,-rpath=$(LIBDIR)/lib -ldl |
| LIBSCRIPTS = vps-create vps-postcreate vps-net_add vps-net_del vps-stop \ |
| vps-functions |
| |
| PROGS = vzctl vzlist arpsend vzsplit vzcfgvalidate vzmemcheck vzcalc |
| LIBS = $(LIB_vzctl) $(LIB_simfs) |
| |
| INITSCRIPTS = vz |
| CRONSCRIPTS = vpsreboot vpsnetclean |
| SCRIPTS = vpsreboot vpsnetclean |
| NETSCRIPTS = ifcfg-venet0 ifdown-venet ifup-venet |
| VECONFIG = ve-light.conf-sample ve-vps.basic.conf-sample |
| VECONFIG_IA64 = ve-light.conf-sample ve-vps.basic.conf-sample |
| VECONFIG_X86_64 = ve-light.conf-sample ve-vps.basic.conf-sample |
| |
| default: all |
| |
| all: $(PROGS) $(LIBS) |
| |
| %.o: %.c |
| $(CC) -c $(CFLAGS) $(INC) $< -o $@ |
| |
| %.lo: %.c |
| $(CC) -c $(CFLAGS) $(SHAREDLIB_CFLAGS) $(INC) $< -o $@ |
| |
| $(LIB_simfs) : $(OBJ_simfs) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_simfs) -shared -o $@ |
| |
| $(LIB_fs): $(LIB_simfs) |
| ln -sf $(LIB_simfs) $(LIB_fs) |
| |
| libvzctl.a: $(OBJ_libvzctl) |
| ar scq $@ $+ |
| ranlib $@ |
| |
| $(LIB_vzctl) : $(LIB_simfs) $(OBJ_libvzctl) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_libvzctl) $(LD_FLAGS) -shared -o $@ |
| |
| vzctl-static: $(OBJ_vzctl) libvzctl.a |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_vzctl) $(OBJ_simfs) libvzctl.a -rdynamic -ldl -lutil -o $@ |
| |
| vzctl: $(LIB_vzctl) $(OBJ_vzctl) $(LIB_fs) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_vzctl) $(LD_FLAGS) $(LIB_vzctl) $(LIB_fs) -lutil -o $@ |
| |
| vzlist: $(OBJ_vzlist) $(LIB_vzctl) $(LIB_fs) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(OBJ_vzlist) $(LD_FLAGS) $(LIB_fs) $(LIB_vzctl) -o $@ |
| |
| arpsend: $(OBJ_arp) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ |
| |
| vzsplit: $(OBJ_split) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ -o $@ |
| |
| vzmemcheck: $(OBJ_memcheck) $(LIB_vzctl) $(LIB_fs) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $(LD_FLAGS) $(LIB_fs) $(LIB_vzctl) $^ -o $@ |
| |
| vzcfgvalidate: $(OBJ_cfgvalidate) $(LIB_vzctl) $(LIB_fs) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LD_FLAGS) $(LIB_fs) $(LIB_vzctl) -o $@ |
| |
| vzcalc: $(OBJ_calc) $(LIB_vzctl) $(LIB_fs) |
| $(CC) $(CFLAGS) $(INC) $(LDFLAGS) $^ $(LD_FLAGS) $(LIB_fs) $(LIB_vzctl) -o $@ |
| |
| inst-sbin :$(PROGS) |
| for file in $(PROGS); do \ |
| $(INSTALL) $$file $(DESTDIR)$(SBINDIR)/$$file; \ |
| done |
| install-lib: $(LIB_vzctl) $(LIB_fs) |
| $(INSTALL) -d $(DESTDIR)$(LIBDIR)/lib |
| $(INSTALL) -d $(DESTDIR)$(LIBDIR)/scripts |
| $(INSTALL) $(LIB_vzctl) $(DESTDIR)$(LIBDIR)/lib/$(LIB_vzctl) |
| $(INSTALL) $(LIB_simfs) $(DESTDIR)$(LIBDIR)/lib/$(LIB_simfs) |
| cp -a $(LIB_fs) $(DESTDIR)$(LIBDIR)/lib/$(LIB_fs) |
| for file in $(LIBSCRIPTS); do \ |
| $(INSTALL) ../etc/$$file $(DESTDIR)$(LIBDIR)/scripts/$$file; \ |
| done |
| inst-scripts: |
| for file in $(SCRIPTS); do \ |
| $(INSTALL) ../etc/$$file $(DESTDIR)$(VPSCONFDIR)/$$file; \ |
| done |
| inst-netscripts: |
| for file in $(NETSCRIPTS); do \ |
| $(INSTALL) ../etc/$$file $(DESTDIR)$(NETSCRIPTDIR)/$$file; \ |
| done |
| inst-configs: |
| $(INSTALL) -m 644 ../etc/vz $(DESTDIR)$(GLBCONFIG) |
| ifeq ($(ARCH),ia64) |
| for file in $(VECONFIG_IA64); do \ |
| $(INSTALL) ../etc/$$file.ia64 $(DESTDIR)$(VPSCONFDIR)/$$file; \ |
| done |
| else |
| ifeq ($(ARCH),x86_64) |
| for file in $(VECONFIG_X86_64); do \ |
| $(INSTALL) ../etc/$$file.x86_64 $(DESTDIR)$(VPSCONFDIR)/$$file; \ |
| done |
| else |
| for file in $(VECONFIG); do \ |
| $(INSTALL) ../etc/$$file $(DESTDIR)$(VPSCONFDIR)/$$file; \ |
| done |
| endif |
| endif |
| inst-initd: |
| for file in $(INITSCRIPTS); do \ |
| $(INSTALL) ../etc/init.d/$$file $(DESTDIR)$(INITDDIR)/$$file; \ |
| done |
| |
| inst-cron: |
| for file in $(CRONSCRIPTS); do \ |
| $(INSTALL) ../etc/cron.d/$$file $(DESTDIR)$(CRONDDIR)/$$file; \ |
| done |
| |
| inst-dirs: |
| $(INSTALL) -d $(DESTDIR)$(SBINDIR) |
| $(INSTALL) -d $(DESTDIR)$(VPSCONFDIR) |
| $(INSTALL) -d $(DESTDIR)$(DISTCONFDIR) |
| $(INSTALL) -d $(DESTDIR)$(NETSCRIPTDIR) |
| $(INSTALL) -d $(DESTDIR)$(VPSCONFDIR) |
| $(INSTALL) -d $(DESTDIR)$(CRONDDIR) |
| $(INSTALL) -d $(DESTDIR)$(INITDDIR) |
| $(INSTALL) -d $(DESTDIR)$(VZLOCKDIR) |
| $(INSTALL) -d $(DESTDIR)$(LOGRDIR) |
| $(INSTALL) -d $(DESTDIR)$(CACHEDIR) |
| $(INSTALL) -m 644 ../etc/logrotate.d/vzctl $(DESTDIR)$(LOGRDIR)/vzctl |
| |
| install: $(PROGS) inst-dirs install-lib inst-sbin inst-scripts \ |
| inst-netscripts inst-configs inst-initd inst-cron |
| clean: |
| rm -f *.o lib/*.lo $(PROGS) $(LIB_vzctl) $(LIB_fs) $(LIB_simfs) .depend |
| |
| .depend:: $(OBJ:.o=.c) $(LOBJ:.lo=.c) |
| $(CC) -M $(FLAGS) $(DEPFLAGS) $(INC) $^ >.depend |
| |
| depend:: .depend |
| |
| include .depend |
| |
| |
| .PHONY: clean depend install inst-dirs inst-config \ |
| inst-initd install-cron all default inst-config inst-lib |
| |
| |