-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
51 lines (33 loc) · 1.12 KB
/
Makefile
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
# Author: Nicholas DeCicco <[email protected]>
CC = gcc
CFLAGS = -Wall -g
LIBS = -lnetcdf
AR = ar
STATIC_LIB = libgeomag.a
SHARED_LIB = libgeomag.so.1.0.0
EMBEDDED_LIB = libgeomag-embedded.a
OBJS = geomag.o
UNIT_TESTS = test_geomag print_model
all: $(UNIT_TESTS) $(STATIC_LIB) #$(SHARED_LIB)
$(OBJS): %.o : %.c
$(CC) -fPIC $(CFLAGS) -c $< -o $@
$(STATIC_LIB): $(OBJS)
$(AR) rcs $@ $<
geomag-embedded.o: geomag.c
$(CC) -fPIC $(CFLAGS) -DTARGET_EMBEDDED -c $< -o $@
$(EMBEDDED_LIB): geomag-embedded.o igrf.o
$(AR) rcs $@ $^
$(SHARED_LIB): $(OBJS)
$(CC) -shared -Wl,-soname,libgeomag.so.1 -o $@ $<
$(UNIT_TESTS): % : %.c $(STATIC_LIB)
$(CC) -L. $(CFLAGS) $< -Bstatic -lgeomag -Bdynamic $(LIBS) -o $@
igrf.c: print_model
./print_model
igrf.o: igrf.c
$(CC) $(CFLAGS) -c $< -o $@
test_geomag_embedded: test_geomag.c libgeomag-embedded.a
$(CC) -L. $(CFLAGS) -DTEST_EMBEDDED $< -Bstatic -lgeomag-embedded -Bdynamic $(LIBS) -o $@
clean:
-rm $(UNIT_TESTS) $(OBJS) $(SHARED_LIB) $(STATIC_LIB)
-rm libgeomag-embedded.a igrf.o geomag-embedded.o test_geomag_embedded