summaryrefslogtreecommitdiffstats
path: root/oncology/dpfhack_display/unixdll.mk
blob: 3130e02e8f6a7adc03c5ebc4dd085272dcb22d54 (plain)
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
#
# Common makefile to create a unix .so
#
# $Id: unixdll.mk 292 2010-01-07 19:35:21Z strubi $
#

OPTIMIZATIONS = -finline-functions #-O2

CXXFLAGS = $(INCLUDES)  $(OPTIMIZATIONS)
CXXFLAGS += $(DLLFLAGS) 
CXXFLAGS += -Wall -MD

CFLAGS = $(INCLUDES)  $(OPTIMIZATIONS) 
CFLAGS += $(DLLFLAGS) 
CFLAGS += -Wall -MD
CFLAGS += -fPIC

ifdef RELEASE
	CONFIG = Release
else
	CONFIG = Debug
endif

ifndef RELEASE
	CFLAGS += $(DEBUGOPTS)
endif

OBJDIR = $(CONFIG)

ifndef PREFIX
	PREFIX = .
endif

DLLCOMMONOBJS = $(DLLCOMMONSRCS:%.c=$(OBJDIR)/%.o)
DLLCPPOBJS = $(DLLCPPSRCS:%.cpp=$(OBJDIR)/%.o)
DLLOBJS = $(DLLCSRCS:%.c=$(OBJDIR)/%.o) $(DLLCOMMONOBJS)
DLLOBJS += $(DLLCPPOBJS)
ifndef DLLINSTALLDIR
	DLLINSTALLDIR = $(NETPP)/$(CONFIG)
endif

#
# Please don't change this: 
ifndef DLLTYPE
	DLLTYPE = $(LIBNAME)
endif

DLL = $(OBJDIR)/lib$(LIBNAME).so
STATICLIB = $(OBJDIR)/lib$(LIBNAME).a
DLLEXT = .so

ifndef INSTALLBASE
	INSTALLNAME = $(DLLTYPE)
else
	INSTALLNAME = $(LIBNAME)
endif

############################################################################
# RULES
#

$(OBJDIR)/%.o : %.cpp
	$(CXX) -o $@  -c $< $(CXXFLAGS) 

$(OBJDIR)/%.o : %.c
	$(CC) -o $@  -c $< $(CFLAGS) 

$(OBJDIR)/%.o: $(PREFIX)/%.c
	$(CC) -o $@ -c $< $(CFLAGS) 

$(OBJDIR)/%.o: $(COMMONSRCDIR)/%.c
	$(CC) -o $@ -c $< $(CFLAGS) 

dll: $(DLL)
	
$(DLL): dirs $(DLLOBJS)
	$(CC) -o $(DLL) -shared $(DLLOBJS) $(DLLDEPS)


# Make DLL directory, if it does not exist
$(OBJDIR):
	[ -e $(OBJDIR) ] || mkdir $(OBJDIR)

dirs: $(OBJDIR)

$(STATICLIB): dirs $(DLLOBJS)
	$(AR) ruv $(STATICLIB) $(DLLOBJS)
	
libclean:
	rm -f $(DLL) $(STATICLIB)

installdll:: $(DLL)
	[ -e $(DLLINSTALLDIR) ] || mkdir $(DLLINSTALLDIR)
	cp $(DLL) $(DLLINSTALLDIR)/lib$(INSTALLNAME).so

clean::
	rm -f $(DLLOBJS)
	rm -fr Debug/ Release/
	rm -f *.d
	rm -fr $(NETPP)/Debug
	rm -fr $(NETPP)/Release