vmod/vmodttl: fixed bug related to luns not ordered and/or not starting from zero.
[ht-drivers.git] / makefiles / Makefile.libtst
blob37c51cfa54794e1b1858fcd5dcf7d1b7ba164eea
1 ###############################################################################
2 # @file Makefile.tst
4 # @brief Builds up test programs.
6 # @author Yury GEORGIEVSKIY, CERN.
8 # @date Created on 13/01/2009
9 ###############################################################################
11 # Makefile from current directory supress one from upper level
12 include $(shell if [ -e ./Makefile.specific ]; then \
13                 echo ./Makefile.specific; \
14         else \
15                 echo ../Makefile.specific; \
16 fi)
18 include ../$(ROOTDIR)/makefiles/Makefile.base
19 include ../$(ROOTDIR)/makefiles/rules.mk
21 vpath %.c ./  ../../utils/user ../../utils/extest
23 ADDCFLAGS  = $(STDFLAGS) -DDRIVER_NAME=\"$(DRIVER_NAME)\"
25 # libraries (and their pathes) to link executable file with
26 XTRALIBDIRS = ../$(ROOTDIR)/utils/user/object ../$(ROOTDIR)/lib/stub/object ../$(FINAL_DEST)
27 LOADLIBES  := $(addprefix -L,$(XTRALIBDIRS)) $(LOADLIBES) -lutils.$(CPU) -lstub.$(CPU)
29 # Get all local libs (in object_ directory) user wants to compile with
30 LOCAL_LIBS = $(patsubst ../$(FINAL_DEST)/lib%.a, -l%, $(wildcard ../$(FINAL_DEST)/*.$(CPU).a))
31 XTRALIBS   = -lxml2 -lz -lreadline
32 LDLIBS     = \
33            $(LOCAL_LIBS) \
34            $(XTRALIBS)
36 SRCFILES = $(wildcard *.c)
38 # the standard test program (utils/extest) will be compiled
39 # unless USE_EXTEST is set to 'n'
40 ifneq ($(USE_EXTEST), n)
41 SRCFILES += \
42         extest.c
44 # if the driver is skel, we'll compile in all the skel handlers
45 ifeq ($(IS_SKEL), y)
46 SRCFILES += cmd_skel.c
47 ADDCFLAGS += -D__SKEL_EXTEST__
48 else
49 # if not, then the generic ones are taken to handle built-in commands
50 SRCFILES += cmd_generic.c
51 endif
53 endif # end USE_EXTEST
55 ifeq ($(CPU), ppc4)
56 SRCFILES    += extra_for_lynx.c
57 # for dlopen, dlclose etc.
58 LOADLIBES += /acc/sys/$(CPU)/lib/shlib/libdl.so
59 else
60 LOADLIBES += -lrt -ltermcap
61 endif
63 INCDIRS = \
64         ./ \
65         ../.. \
66         ../driver \
67         ../include \
68         ../../utils \
69         ../../utils/user \
70         ../../include \
71         ../../lib \
72         ../../utils/extest \
73         /acc/local/$(CPU)/include
75 EXEC_OBJS = $(DRIVER_NAME)Test-stub.$(CPU)
77 $(EXEC_OBJS): $(OBJFILES)
79 _build: $(EXEC_OBJS) $(OBJDIR) $(FINAL_DEST) move_objs
81 # Move compiled files to proper place
82 move_objs:
83         $(Q)mv $(OBJFILES) $(OBJDIR)
84         $(Q)mv $(EXEC_OBJS) ../$(FINAL_DEST)
86 # CERN delivery
87 include ../$(ROOTDIR)/makefiles/deliver.mk
89 cleanloc clearloc:: abort
90         @ if [ -n "$(OBJDIR)" ]; then \
91                 rm -rf $(OBJDIR)* ; \
92         fi
93         -rm -f ../$(FINAL_DEST)/testprog $(DRIVER_NAME)libTst
94         -find ./ -name '*~' -o -name '*.$(CPU).o' | xargs rm -f