Philippe 02/05/2016: moved all LIBTOOLS files in LIBTOOLS directory
[MNH-git_open_source-lfs.git] / LIBTOOLS / tools / lfiz / Makefile
1 VPATH=src:$(DIR_OBJ)
2 ###########################
3 DIR_OBJ = ./$(ARCH)
4
5 include ../where.Libs
6
7 INC = -I$(DIR_COMP)/$(ARCH)
8
9 include $(DIR_CONF)/config.$(ARCH)
10 include Rules.$(ARCH)
11
12 PROGS = lfiz unlfiz testlibcomp
13
14 %.o:%.f90 $(DIR_OBJ)/.dummy
15         $(CPP) $(INC) $(CPPFLAGS) $< >  $(DIR_OBJ)/cpp_$(*F).f90
16         $(F90) $(INC) -c $(F90FLAGS) $(DIR_OBJ)/cpp_$(*F).f90 -o $(DIR_OBJ)/$(*F).o
17
18 all: $(PROGS)
19
20 $(PROGS): %:%.o  $(LIBCOMP) $(LIBLFI)
21         cd $(DIR_OBJ); $(F90) $(LDFLAGS) -o $@ $@.o $(LIBLFI) $(LIBCOMP) $(LIBS)
22
23 $(DIR_OBJ)/.dummy:
24         mkdir -p $(DIR_OBJ)
25         @touch $(DIR_OBJ)/.dummy
26
27 $(LIBLFI): $(DIR_LFI)
28         $(MAKE) -C $(DIR_LFI)
29
30 $(LIBCOMP): $(DIR_COMP)
31         $(MAKE) -C $(DIR_COMP)
32
33 $(DIR_LFI) $(DIR_COMP):        
34         @echo "ERROR : COMPRESS and/or NEWLFI directory can't be found"
35         @echo "        from root directory DIR_LIB = $(DIR_LIB)";echo
36         @echo "Please check SRC_MESONH or DIR_LIB environment variable"
37         @echo "and try again...";exit 1
38
39 clean:
40         (if [ -d $(DIR_OBJ) ] ; then cd $(DIR_OBJ); rm -f cpp_*.f90 cpp_*.f *.o *.mod ; fi)
41
42 distclean:
43         rm -rf $(DIR_OBJ)