File: makefile

package info (click to toggle)
g2clib 1.4.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 608 kB
  • ctags: 226
  • sloc: ansic: 4,995; makefile: 194
file content (165 lines) | stat: -rwxr-xr-x 3,586 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
SHELL=/bin/sh

#  If you want to enable support for PNG or JPEG2000 encoding/decoding,
#  you must specify -DUSE_PNG and/or -DUSE_JPEG2000 in the DEFS variable
#  for the C pre-processor
#  -DUSE_PNG requires libpng.a and libz.a
#                     ( and png.h pngconf.h zconf.h zlib.h include files).
#  -DUSE_JPEG2000 requires libjasper.a
#                     ( and all the jasper/*.h include files).
#
#  In addition, INC must include all directories where the above
#  mentioned include files can be found.
DEFS=-DUSE_JPEG2000 -DUSE_PNG

#
# Please make sure to include all idirectories where include files  
#     can be found (jasper/*.h and png.h pngconf.h zconf.h zlib.h)
#

#
#   This "C" source code contains many uses of the C++
#   comment style "//".  Please make sure you include the
#   appropriate compiler flag to allow the use of "//" comment indicators.
#

CFLAGS:= $(INC) $(DEFS) $(CFLAGS) $(CPPFLAGS)

PIC:= -fPIC

prefix=/usr
LIBDIR=/usr/lib
SHLIB=libgrib2c.so.0d
SONAME=libgrib2c.so.0d

CC=cc

LIB=libgrib2c.a
ARFLAGS=

$(LIB)(gridtemplates.o): gridtemplates.h

$(LIB)(pdstemplates.o): pdstemplates.h

$(LIB)(drstemplates.o): drstemplates.h

$(LIB):	$(LIB)(gridtemplates.o) \
	$(LIB)(drstemplates.o) \
	$(LIB)(pdstemplates.o) \
	$(LIB)(gbits.o) \
	$(LIB)(g2_unpack1.o) \
	$(LIB)(g2_unpack2.o) \
	$(LIB)(g2_unpack3.o) \
	$(LIB)(g2_unpack4.o) \
	$(LIB)(g2_unpack5.o) \
	$(LIB)(g2_unpack6.o) \
	$(LIB)(g2_unpack7.o) \
	$(LIB)(g2_free.o) \
	$(LIB)(g2_info.o) \
	$(LIB)(g2_getfld.o) \
	$(LIB)(simunpack.o) \
	$(LIB)(comunpack.o) \
        $(LIB)(pack_gp.o) \
        $(LIB)(reduce.o) \
	$(LIB)(specpack.o) \
	$(LIB)(specunpack.o) \
	$(LIB)(rdieee.o) \
	$(LIB)(mkieee.o) \
	$(LIB)(int_power.o) \
	$(LIB)(simpack.o) \
	$(LIB)(compack.o) \
        $(LIB)(cmplxpack.o) \
	$(LIB)(misspack.o) \
	$(LIB)(jpcpack.o) \
	$(LIB)(jpcunpack.o) \
	$(LIB)(pngpack.o) \
	$(LIB)(pngunpack.o) \
	$(LIB)(dec_jpeg2000.o) \
	$(LIB)(enc_jpeg2000.o) \
	$(LIB)(dec_png.o) \
	$(LIB)(enc_png.o) \
	$(LIB)(g2_create.o) \
	$(LIB)(g2_addlocal.o) \
	$(LIB)(g2_addgrid.o) \
	$(LIB)(g2_addfield.o) \
	$(LIB)(g2_gribend.o) \
	$(LIB)(getdim.o) \
	$(LIB)(g2_miss.o) \
	$(LIB)(getpoly.o) \
	$(LIB)(seekgb.o)

.c.a:
	$(CC) -c $(CFLAGS) $(PIC) $<
	ar $(ARFLAGS) -ruv $@ $*.o
	rm -f $*.o

.c.o:
	$(CC)  -c $(CFLAGS) $(PIC) $<

clean:
	rm -f *.o *.a *.so grib2c.pc lib*

LIBS= `pkg-config --libs libpng` -ljasper -lm
OBJS:=  gridtemplates.o \
	 drstemplates.o \
	 pdstemplates.o \
	 gbits.o \
	 g2_unpack1.o \
	 g2_unpack2.o \
	 g2_unpack3.o \
	 g2_unpack4.o \
	 g2_unpack5.o \
	 g2_unpack6.o \
	 g2_unpack7.o \
	 g2_free.o \
	 g2_info.o \
	 g2_getfld.o \
	 simunpack.o \
	 comunpack.o \
	 pack_gp.o \
	 reduce.o \
	 specpack.o \
	 specunpack.o \
         rdieee.o \
  	 mkieee.o \
	 int_power.o \
	 simpack.o \
	 compack.o \
	 cmplxpack.o \
	 misspack.o \
	 jpcpack.o \
	 jpcunpack.o \
	 pngpack.o \
	 pngunpack.o \
	 dec_jpeg2000.o \
	 enc_jpeg2000.o \
	 dec_png.o \
	 enc_png.o \
	 g2_create.o \
	 g2_addlocal.o \
	 g2_addgrid.o \
	 g2_addfield.o \
	 g2_gribend.o \
	 getdim.o \
	 g2_miss.o \
	 getpoly.o \
	 seekgb.o


all: $(LIB) $(SHLIB)

$(SHLIB): $(OBJS)
	gcc $(LDFLAGS) -Wl,-as-needed -shared  -o $(SHLIB) -Wl,-soname,$(SONAME) $(OBJS) $(LIBS)

grib2c.pc: grib2c.pc.in
	cat grib2c.pc.in | sed -e 's!@prefix@!${PREFIX}!' | sed -e 's!@libdir@!${LIBDIR}!' > grib2c.pc

install: $(LIB) $(SHLIB) grib2c.pc
	mkdir -p $(LIBDIR)
	cp $(LIB) $(SHLIB) $(LIBDIR)
	mkdir -p $(LIBDIR)/pkgconfig
	cp grib2c.pc $(LIBDIR)/pkgconfig
	mkdir -p $(prefix)/include
	cp grib2.h $(prefix)/include

.PHONY: clean install