| 1 | #  ------------------ SOPHYA ------------------------- | 
|---|
| 2 | #    Makefile fot compiling and linking a simple C++ | 
|---|
| 3 | #         program with SOPHYA class library | 
|---|
| 4 | #  --------------------------------------------------- | 
|---|
| 5 | #  GNU make program should be used with this makefile | 
|---|
| 6 | #  --------------------------------------------------- | 
|---|
| 7 | #  Usage: make | 
|---|
| 8 | #     - compiles ex1.cc -> Objs/ex1.o | 
|---|
| 9 | #     - links Objs/ex1.o -> Objs/ex1 | 
|---|
| 10 | #         make depend | 
|---|
| 11 | #         to create the Objs/ directory | 
|---|
| 12 |  | 
|---|
| 13 | #   SOPHYA compilation rules - OPTFLAG and DBGFLAG | 
|---|
| 14 | # can be used to define Debug and optimization flags | 
|---|
| 15 | # Additional options can be specified using USERFLAGS | 
|---|
| 16 | # USERFLAGS := -I/.../myincludes | 
|---|
| 17 |  | 
|---|
| 18 | include $(DPCBASEREP)/Include/MakefileUser.h | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | # ----- List of SOPHYA libraries | 
|---|
| 22 | ifdef NOSHLIB | 
|---|
| 23 | LIBF =  $(LIB)libLinAlg.a $(LIB)libIFFTW.a $(LIB)libFitsIOServer.a $(LIB)libSamba.a $(LIB)libSkyMap.a $(LIB)libSkyT.a $(LIB)libNTools.a $(LIB)libHiStats.a $(LIB)libTArray.a $(LIB)libSysTools.a | 
|---|
| 24 | LIBS = -L$(LIB) -lLinAlg -lIFFTW -lFitsIOServer -lSamba -lSkyMap -lSkyT -lNTools -lHiStats -lTArray -lSysTools -lm | 
|---|
| 25 | ifeq ($(CXX),cxx) | 
|---|
| 26 | # librairie des instances de templates cxx | 
|---|
| 27 | LIBS := $(LIBS) -lsotcxx | 
|---|
| 28 | endif | 
|---|
| 29 | else | 
|---|
| 30 | LIBF =  $(SLB)libsophya.so $(SLB)libextsophya.so | 
|---|
| 31 | LIBS = -L$(SLB) -lextsophya -lsophya  -lm | 
|---|
| 32 | endif | 
|---|
| 33 |  | 
|---|
| 34 | LDLIBS := $(LIBS) $(LDLIBS) | 
|---|
| 35 |  | 
|---|
| 36 | #  Object and executable files will be put in | 
|---|
| 37 | MYOBJS := Objs/ | 
|---|
| 38 |  | 
|---|
| 39 | #  --- Compilation and linking rules | 
|---|
| 40 | $(MYOBJS)%.o:%.cc | 
|---|
| 41 | $(COMPILE.cc)   $(USERFLAGS) -o $@ $< | 
|---|
| 42 |  | 
|---|
| 43 | $(MYOBJS)%:%.c | 
|---|
| 44 | $(COMPILE.c)  $(USERFLAGS) -o $@ $< | 
|---|
| 45 |  | 
|---|
| 46 |  | 
|---|
| 47 | #  list of default build target | 
|---|
| 48 | all : depend $(MYOBJS)ex1 | 
|---|
| 49 |  | 
|---|
| 50 | #  Clean procedure | 
|---|
| 51 | clean : | 
|---|
| 52 | rm -f $(MYOBJS)ex1 $(MYOBJS)ex1.o | 
|---|
| 53 | #  Directory buid procedure | 
|---|
| 54 | depend : | 
|---|
| 55 | if (test ! -d $(MYOBJS) ) then mkdir $(MYOBJS) ; fi | 
|---|
| 56 |  | 
|---|
| 57 | #  build rules for ex1 | 
|---|
| 58 | $(MYOBJS)ex1 : $(MYOBJS)ex1.o | 
|---|
| 59 | $(LINK.cc) $^ $(LIBS) -o $@ | 
|---|
| 60 | $(MYOBJS)ex1.o : ex1.cc | 
|---|
| 61 |  | 
|---|
| 62 |  | 
|---|
| 63 |  | 
|---|