-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
130 lines (93 loc) · 2.43 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
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
#///////////////////////////////////////////////////////////////////////////////
#//
#// Makefile for the Data Lab Package Applications
#//
#///////////////////////////////////////////////////////////////////////////////
# primary dependencies
NAME = fits2db
VERSION = 1.0
PLATFORM := $(shell uname -s)
PLMACH := $(shell uname -m)
HERE := $(shell /bin/pwd)
BINDIR := ./
LIBDIR := ./
INCDIR := ./
ifeq ($(PLATFORM),Darwin)
ifeq ($(PLMACH),x86_64)
CARCH =
else
CARCH =
endif
else
CLIBS = -lm -lpthread
CARCH =
LIBCURL =
endif
DEPLIBS = -lcfitsio -lpthread -lm
CLIBS = -lm -lc
CFLAGS = -g -Wall $(CARCH) -D$(PLATFORM) $(CINCS)
LIBCFITSIO = -lcfitsio
# includes, flags and libraries
CC = gcc
CINCS = -I$(HERE) -I./ -I../include -I/usr/include/cfitsio -I/usr/local/include
# list of source and include files
C_SRCS = fits2db.c
C_OBJS = fits2db.o
C_INCS =
C_TASKS = fits2db
TARGETS = $(C_TASKS)
SRCS = $(C_SRCS)
OBJS = $(C_OBJS)
HOST_LIBS = $(LIBCFITSIO) -lpthread -lm
LIBS = -L/usr/local/lib $(HOST_LIBS)
all:
make fits2db
World:
install: all
objs: $(OBJS)
# Targets
c_progs: $(C_TASKS)
spp_progs: $(SPP_TASKS)
f77_progs: $(F77_TASKS)
distclean:
make clean
/bin/rm -rf *.fits *.xml
clean:
/bin/rm -rf .make.state .nse_depinfo *.[aeo] *.dSYM
/bin/rm -rf $(TARGETS)
everything:
make clean
make all
make install
help: HELP
install: all
####################################
# LIBDLAPPS dependency libraries.
####################################
lib:
(cd lib ; make all)
lib$(NAME).a:
(cd lib ; make all)
###########################
# C Test programs
###########################
fits2db: fits2db.o
$(CC) $(CFLAGS) -o fits2db fits2db.o $(LIBS)
/bin/rm -rf fits2db.dSYM
###############################################################################
# Leave this stuff alone.
###############################################################################
$(STATICLIB): $(C_SRCS:%.c=Static/%.o)
/usr/bin/ar rv $@ $?
Static/%.o: %.c $(C_INCS)
/usr/bin/gcc $(CINCS) $(CFLAGS) -g -c $< -o $@
Static:
/bin/mkdir $@
chmod 777 $@
$(SHAREDLIB): $(C_SRCS:%.c=Shared/%.o)
/usr/bin/ld -shared -o $@ $? -lc -ldl
Shared/%.o: %.c $(C_INCS)
/usr/bin/gcc $(CINCS) $(CFLAGS) -fpic -shared -c $< -o $@
Shared:
/bin/mkdir $@
chmod 777 $@