| 1 | # -*- mode: Makefile; -*- |
|---|
| 2 | #============================================================================ |
|---|
| 3 | # |
|---|
| 4 | # Copyright (C) 2004 Mike Wray <mike.wray@hp.com> |
|---|
| 5 | # |
|---|
| 6 | # This program is free software; you can redistribute it and/or modify |
|---|
| 7 | # it under the terms of the GNU General Public License as published by the |
|---|
| 8 | # Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 9 | # option) any later version. |
|---|
| 10 | # |
|---|
| 11 | # This program is distributed in the hope that it will be useful, but |
|---|
| 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|---|
| 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|---|
| 14 | # for more details. |
|---|
| 15 | # |
|---|
| 16 | # You should have received a copy of the GNU General Public License along |
|---|
| 17 | # with this program; if not, write to the Free software Foundation, Inc., |
|---|
| 18 | # 59 Temple Place, suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | #============================================================================ |
|---|
| 20 | |
|---|
| 21 | ifndef VNET_ROOT |
|---|
| 22 | export VNET_ROOT = $(shell cd .. && pwd) |
|---|
| 23 | include $(VNET_ROOT)/Make.env |
|---|
| 24 | endif |
|---|
| 25 | |
|---|
| 26 | #============================================================================ |
|---|
| 27 | ifeq ($(src),) |
|---|
| 28 | |
|---|
| 29 | include Makefile-$(LINUX_SERIES) |
|---|
| 30 | |
|---|
| 31 | #============================================================================ |
|---|
| 32 | else |
|---|
| 33 | #============================================================================ |
|---|
| 34 | # This section is for the 2.6 kbuild. |
|---|
| 35 | |
|---|
| 36 | #$(warning KBUILD_EXTMOD $(KBUILD_EXTMOD)) |
|---|
| 37 | #$(warning src $(src)) |
|---|
| 38 | #$(warning obj $(obj)) |
|---|
| 39 | |
|---|
| 40 | include $(src)/Makefile.vnet |
|---|
| 41 | |
|---|
| 42 | obj-m = vnet_module.o |
|---|
| 43 | vnet_module-objs = $(VNET_OBJ) |
|---|
| 44 | vnet_module-objs += $(VNET_LIB_OBJ) |
|---|
| 45 | |
|---|
| 46 | #---------------------------------------------------------------------------- |
|---|
| 47 | # The fancy stuff in the kernel build defeats 'vpath %.c' so we can't |
|---|
| 48 | # use that to get the lib files compiled. |
|---|
| 49 | # Setup explicit rules for them using the kbuild C compile rule. |
|---|
| 50 | |
|---|
| 51 | # File names in the lib dir. |
|---|
| 52 | remote_srcs = $(foreach file,$(VNET_LIB_SRC),$(LIBXUTIL_DIR)/$(file)) |
|---|
| 53 | |
|---|
| 54 | # Equivalent file names here. |
|---|
| 55 | local_srcs = $(foreach file,$(VNET_LIB_SRC),$(src)/$(file)) |
|---|
| 56 | |
|---|
| 57 | # Objects for the local names. |
|---|
| 58 | local_objs = $(local_srcs:.c=.o) |
|---|
| 59 | |
|---|
| 60 | # Make the local objects depend on compiling the remote sources. |
|---|
| 61 | $(local_objs): $(src)/%.o: $(LIBXUTIL_DIR)/%.c |
|---|
| 62 | $(call if_changed_rule,cc_o_c) |
|---|
| 63 | #---------------------------------------------------------------------------- |
|---|
| 64 | |
|---|
| 65 | vpath %.h $(LIBXUTIL_DIR) |
|---|
| 66 | EXTRA_CFLAGS += -I $(LIBXUTIL_DIR) |
|---|
| 67 | EXTRA_CFLAGS += -I $(src) |
|---|
| 68 | |
|---|
| 69 | endif |
|---|
| 70 | #============================================================================ |
|---|
| 71 | |
|---|