File: Makefile.in

package info (click to toggle)
koala 0.3.2a-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,036 kB
  • ctags: 582
  • sloc: ansic: 29,449; makefile: 1,666; xml: 11
file content (207 lines) | stat: -rw-r--r-- 7,256 bytes parent folder | download | duplicates (3)
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# @(#) nitehawk@paranor.1ststep.net|Makefile.in|20001110040455|04941 @(#)
#	Copyright (c) 1999-2000 First Step Internet Services, Inc.
#
#	Component:
#		MAKE

# Flags to add to compile lines
# First line is for debug, second line is for production
MYCFLAGS = -Wall -g
#MYCFLAGS = -O2 -Wall

######################################################
# Nothing below this line should need changed
######################################################

# Compiler to use (Only tested with GCC currently)
CC = @CC@

# Defines
DEFINES = @DEFS@

# Directories
TOPLEVEL = @top_srcdir@
srcdir = @top_srcdir@/src
objdir = $(srcdir)/obj
INCDIR := $(TOPLEVEL)/include
BINDIR := $(TOPLEVEL)/bin
LIBDIR := $(TOPLEVEL)/lib
LIBOBJ := $(LIBDIR)/obj
ZOBJDIR := $(srcdir)/zone/obj
HOBJDIR := $(srcdir)/hub/obj
COBJDIR := $(srcdir)/client/obj
IDNSOBJDIR := $(srcdir)/idnsd/obj
DOBJDIRS := $(ZOBJDIR) $(HOBJDIR) $(COBJDIR) $(IDNSOBJDIR)
DSRCDIRS := $(srcdir)/zone $(srcdir)/hub $(srcdir)/client $(srcdir)/idnsd
LIBKOALASRC := $(LIBDIR)/koala
LIBKOALAOBJ := $(LIBKOALASRC)/obj
LIBKOALAVMSRC := $(LIBDIR)/vm
LIBKOALAVMOBJ := $(LIBKOALAVMSRC)/obj
LIBKOALAMODSRC := $(LIBDIR)/koalamod
LIBKOALAMODOBJ := $(LIBKOALAMODSRC)/obj
LIBBASECMDSRC := $(LIBDIR)/basecommand
LIBBASECMDOBJ := $(LIBBASECMDSRC)/obj
LIBSRCDIRS := $(LIBKOALASRC) $(LIBKOALAVMSRC) $(LIBKOALAMODSRC) $(LIBBASECMDSRC)
LIBOBJDIRS := $(LIBKOALAOBJ) $(LIBKOALAVMOBJ) $(LIBKOALAMODOBJ) $(LIBBASECMDOBJ)
#vpath %.h $(INCDIR)
vpath %.c $(srcdir) $(LIBSRCDIRS) $(DSRCDIRS)
vpath %.o $(objdir) $(LIBOBJDIRS) $(DOBJDIRS)
vpath %.So $(LIBOBJDIRS)

.SUFFIXES:
.SUFFIXES: .a .o .c .So .so

# libxml flags
XML_CFLAGS = @XML_CFLAGS@
XML_CONFIG = @XML_CONFIG@
XML_LIBS = @XML_LIBS@

# Flags for MySQL
MYSQL_CFLAGS := -I/usr/local/include/mysql
MYSQL_LIBS := -L/usr/local/lib/mysql -lmysqlclient

# Flags to compiler
INCPATHS = -I$(INCDIR)
# For production purposes, use the second line.  For debugging use the first
# to ensure optimizations are off and such
CFLAGS = $(MYCFLAGS) $(INCPATHS) $(DEFINES) $(XML_CFLAGS) 

# Libraries
LIBS := @LIBS@ $(XML_LIBS) 
SHLIBS := @LIBS@ $(XML_LIBS)

# Source Set definitions
LIBKOALA := lib/koala/reboot.c lib/koala/llist.c lib/koala/memory.c
LIBKOALA += lib/koala/uplinkprotocol.c lib/koala/log.c lib/koala/network.c
LIBKOALA += lib/koala/conf.c lib/koala/signal.c lib/koala/buffer.c
LIBKOALA += lib/koala/parser.c lib/koala/commandtablehandler.c
LIBKOALAVM := lib/vm/vm.c lib/vm/bigbuf.c lib/vm/db.c
LIBKOALAVM += lib/vm/dbkoala.c
LIBKOALAMOD := lib/koalamod/loader.c lib/koalamod/init.c
LIBKOALAMOD += lib/koalamod/moduleops.c lib/koalamod/modcommands.c
LIBBASECMD := lib/basecommand/comms.c lib/basecommand/login.c
LIBBASECMD += lib/basecommand/control.c lib/basecommand/info.c
CLIENTDSRC := src/client/client.c
HUBDSRC := src/hub/hub.c
ZONEDSRC := src/zone/zone.c
COMDSRC := src/main.c
IDNSSRC := src/idnsd/idnsd.c
ALLSRC := $(CLIENTDSRC) $(HUBDSRC) $(ZONEDSRC) $(COMDSRC)
ALLSRC += $(LIBKOALA) $(LIBKOALAVM) $(IDNSSRC) $(LIBKOALAMOD) $(LIBBASECMD)

BINS := $(BINDIR)/clientd $(BINDIR)/hubd $(BINDIR)/zoned $(BINDIR)/idnsd
KOALALIB := $(LIBDIR)/libkoala.a $(LIBDIR)/libkoalavm.a
KOALALIB += $(LIBDIR)/libkoalamod.a $(LIBDIR)/libbasecommand.a
KOALASLIB := $(LIBDIR)/libkoala.so $(LIBDIR)/libkoalavm.so
KOALASLIB += $(LIBDIR)/libkoalamod.so $(LIBDIR)/libbasecommand.so
STLIBS = $(LIBDIR)/libbasecommand.a $(LIBDIR)/libkoalamod.a $(LIBDIR)/libkoala.a
#LIBS += -lkoalavm -L$(LIBDIR)

.PHONY : all targets clean almostdistclean distclean tree
all: Makefile libs $(BINS)

targets:
	@echo all, clean, almostdistclean, distclean, tree

clean: 
	rm -f $(BINS)
	rm -f $(KOALALIB) $(KOALASLIB)
	rm -f $(addprefix $(objdir)/, $(notdir $(COMDSRC:%.c=%.o)))
	rm -f $(addprefix $(srcdir)/client/obj/, $(notdir $(CLIENTDSRC:%.c=%.o)))
	rm -f $(addprefix $(srcdir)/hub/obj/, $(notdir $(HUBDSRC:%.c=%.o)))
	rm -f $(addprefix $(srcdir)/zone/obj/, $(notdir $(ZONEDSRC:%.c=%.o)))
	rm -f $(addprefix $(LIBKOALAOBJ)/, $(notdir $(LIBKOALA:%.c=%.o)))
	rm -f $(addprefix $(LIBKOALAOBJ)/, $(notdir $(LIBKOALA:%.c=%.So)))
	rm -f $(addprefix $(LIBKOALAVMOBJ)/, $(notdir $(LIBKOALAVM:%.c=%.o)))
	rm -f $(addprefix $(LIBKOALAVMOBJ)/, $(notdir $(LIBKOALAVM:%.c=%.So)))
	rm -f $(ALLSRC:%.c=%.d)

almostdistclean: clean
	rm -f config.log Makefile
	rm -f include/autoconf.h

distclean: almostdistclean
	rm -r config.cache config.status

Makefile: Makefile.in
	./config.status -recheck
	./config.status

libs: $(KOALALIB) $(KOALASLIB)

tree: 
	if [ ! -d bin ]; then mkdir bin; fi
	if [ ! -d src/obj ]; then mkdir src/obj; fi
	if [ ! -d src/zone/obj ]; then mkdir src/zone/obj; fi
	if [ ! -d src/client/obj ]; then mkdir src/client/obj; fi
	if [ ! -d src/hub/obj ]; then mkdir src/hub/obj; fi
	if [ ! -d src/idnsd/obj ]; then mkdir src/idnsd/obj; fi
	if [ ! -d lib/koala/obj ]; then mkdir lib/koala/obj; fi
	if [ ! -d lib/vm/obj ]; then mkdir lib/vm/obj; fi
	if [ ! -d lib/koalamod/obj ]; then mkdir lib/koalamod/obj; fi
	if [ ! -d lib/basecommand/obj ]; then mkdir lib/basecommand/obj; fi
	if [ ! -d log ]; then mkdir log; fi

#  Include source dependancies
include $(ALLSRC:%.c=%.d)

COMDOBJ = $(notdir $(COMDSRC:%.c=%.o))

CLIENTDOBJ = $(notdir $(CLIENTDSRC:%.c=%.o))
$(BINDIR)/clientd: $(KOALASLIB) $(COMDOBJ) $(CLIENTDOBJ)
	$(CC) -o $@ $(LIBS) $(addprefix $(objdir)/, $(COMDOBJ)) \
	$(addprefix $(srcdir)/client/obj/, $(CLIENTDOBJ)) $(STLIBS)

HUBDOBJ = $(notdir $(HUBDSRC:%.c=%.o))
$(BINDIR)/hubd: $(KOALASLIB) $(COMDOBJ) $(HUBDOBJ)
	$(CC) -o $@ $(LIBS) $(addprefix $(objdir)/, $(COMDOBJ)) \
	$(addprefix $(srcdir)/hub/obj/, $(HUBDOBJ)) $(STLIBS)
	
ZONEDOBJ = $(notdir $(ZONEDSRC:%.c=%.o))
$(BINDIR)/zoned: $(KOALASLIB) $(COMDOBJ) $(ZONEDOBJ)
	$(CC) -o $@ $(LIBS) $(addprefix $(objdir)/, $(COMDOBJ)) \
	$(addprefix $(srcdir)/zone/obj/, $(ZONEDOBJ)) $(STLIBS)

IDNSOBJ = $(notdir $(IDNSSRC:%.c=%.o))
$(BINDIR)/idnsd: $(IDNSOBJ)
	$(CC) -o $@ $(addprefix $(IDNSOBJDIR)/, $(IDNSOBJ))

# Koala Library
lib/libkoala.a: $(notdir $(LIBKOALA:%.c=%.o))
	$(AR) sr $@ $(addprefix $(LIBKOALAOBJ)/, $(?F))
lib/libkoala.so: $(notdir $(LIBKOALA:%.c=%.So))
	$(CC) -shared $(SHLIBS) -Wl,-x -o $@ -Wl,-soname,$@ \
	$(addprefix $(LIBKOALAOBJ)/, $(^F)) 

# Koala Database library
lib/libkoalavm.a: $(notdir $(LIBKOALAVM:%.c=%.o))
	$(AR) sr $@ $(addprefix $(LIBKOALAVMOBJ)/, $(?F))
lib/libkoalavm.so: $(notdir $(LIBKOALAVM:%.c=%.So))
	$(CC) -shared $(SHLIBS) -Wl,-x -o $@ -Wl,-soname,$@ \
	$(addprefix $(LIBKOALAVMOBJ)/, $(^F)) 

# Koala Module Loader
lib/libkoalamod.a: $(notdir $(LIBKOALAMOD:%.c=%.o))
	$(AR) sr $@ $(addprefix $(LIBKOALAMODOBJ)/, $(?F))
lib/libkoalamod.so: $(notdir $(LIBKOALAMOD:%.c=%.So))
	$(CC) -shared $(SHLIBS) -Wl,-x -o $@ -Wl,-soname,$@ \
	$(addprefix $(LIBKOALAMODOBJ)/, $(^F)) 

# Koala Base Command module
lib/libbasecommand.a: $(notdir $(LIBBASECMD:%.c=%.o))
	$(AR) sr $@ $(addprefix $(LIBBASECMDOBJ)/, $(?F))
lib/libbasecommand.so: $(notdir $(LIBBASECMD:%.c=%.So))
	$(CC) -shared $(SHLIBS) -Wl,-x -o $@ -Wl,-soname,$@ \
	$(addprefix $(LIBBASECMDOBJ)/, $(^F)) 

# Implicit rules
.c.o:
	$(CC) $(CFLAGS) -c $< -o $(<D)/obj/$(@F)

.c.So:
	$(CC) -fpic $(CFLAGS) -c $< -o $(<D)/obj/$(@F)

%.d : %.c
	set -e; $(CC) -MM $(CFLAGS) $< \
	  | sed 's#\($(*F)\)\.o[ :]*#\1.o \1.So $@ : #g' > $@; \
	  [ -s $@ ] || rm -f $@