OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [MW_0_8_9PRE7/] [mw/] [src/] [Makefile.rules] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 673 markom
##############################################################################
2
# Microwindows rules Makefile
3
# Copyright (c) 2000 Martin Jolicoeur, Greg Haerr
4
#
5
# This makefile should be placed at the top of a project hierarchy
6
#
7
# NOTE: The TOP environment variable should be set to that top directory
8
##############################################################################
9
 
10
ifeq ($(ARCH), DJGPP)
11
SHELL = bash
12
else
13
SHELL = /bin/sh
14
endif
15
 
16
# install directories for headers and libraries
17
INSTALL_PREFIX = /usr
18
HDRINSTALLDIR = $(INSTALL_PREFIX)/include/microwin
19
LIBINSTALLDIR = $(INSTALL_PREFIX)/lib
20
 
21
INSTALL_DIR   = install -c -m 755 -o root -g root -d
22
INSTALL_HDR   = install -c -m 644 -o root -g bin
23
INSTALL_LIB   = install -c -m 444 -o root -g bin
24
 
25
INCLUDEDIRS += -I. -I$(TOP)/include
26
 
27
#
28
# General configuration setup (see config file)
29
#
30
DEFINES += -DMWPIXEL_FORMAT=$(SCREEN_PIXTYPE)
31
 
32
ifeq ($(VTSWITCH), Y)
33
DEFINES += -DVTSWITCH=1
34
endif
35
 
36
ifeq ($(X11), Y)
37
CFLAGS += -DX11=1
38
LDFLAGS += -L/usr/X11R6/lib -lX11
39
endif
40
 
41
ifeq ($(VGALIB), Y)
42
LDFLAGS += -lvga
43
endif
44
 
45
ifeq ($(ARCH),FREEBSD-X86)
46
LDFLAGS += -lvgl
47
endif
48
 
49
ifeq ($(HAVE_FILEIO), Y)
50
 
51
DEFINES += -DHAVE_FILEIO
52
 
53
ifeq ($(HAVE_JPEG_SUPPORT), Y)
54
DEFINES += -DHAVE_JPEG_SUPPORT=1
55
INCLUDEDIRS += -I$(INCJPEG)
56
endif
57
 
58
ifeq ($(HAVE_PNG_SUPPORT), Y)
59
DEFINES += -DHAVE_PNG_SUPPORT=1
60
INCLUDEDIRS += -I$(INCPNG)
61
endif
62
 
63
ifeq ($(HAVE_T1LIB_SUPPORT), Y)
64
DEFINES += -DHAVE_T1LIB_SUPPORT=1
65
INCLUDEDIRS += -I$(INCT1LIB)
66
endif
67
 
68
ifeq ($(HAVE_FREETYPE_SUPPORT), Y)
69
DEFINES += -DHAVE_FREETYPE_SUPPORT=1
70
DEFINES += -DFREETYPE_FONT_DIR=\"$(FREETYPE_FONT_DIR)\"
71
INCLUDEDIRS += -I$(INCFTLIB)
72
endif
73
 
74
ifeq ($(HAVE_HZK_SUPPORT), Y)
75
DEFINES += -DHAVE_HZK_SUPPORT=1
76
DEFINES += -DHZK_FONT_DIR="\"$(HZK_FONT_DIR)"\"
77
endif
78
 
79
ifeq ($(HAVE_BIG5_SUPPORT), Y)
80
DEFINES += -DHAVE_BIG5_SUPPORT=1
81
endif
82
 
83
ifeq ($(HAVE_GB2312_SUPPORT), Y)
84
DEFINES += -DHAVE_GB2312_SUPPORT=1
85
endif
86
 
87
ifeq ($(HAVE_KSC5601_SUPPORT), Y)
88
DEFINES += -DHAVE_KSC5601_SUPPORT=1
89
DEFINES += -DHANGUL_FONT_DIR="\"$(HANGUL_FONT_DIR)"\"
90
endif
91
 
92
ifeq ($(HAVE_BMP_SUPPORT), Y)
93
DEFINES += -DHAVE_BMP_SUPPORT=1
94
endif
95
 
96
ifeq ($(HAVE_GIF_SUPPORT), Y)
97
DEFINES += -DHAVE_GIF_SUPPORT=1
98
endif
99
 
100
ifeq ($(HAVE_PNM_SUPPORT), Y)
101
DEFINES += -DHAVE_PNM_SUPPORT=1
102
endif
103
 
104
ifeq ($(HAVE_XPM_SUPPORT), Y)
105
DEFINES += -DHAVE_XPM_SUPPORT=1
106
endif
107
 
108
endif
109
 
110
ifeq ($(NOFONTSORCLIPPING), Y)
111
CFLAGS += -DNOFONTSORCLIPPING=1
112
endif
113
 
114
ifeq ($(HAVE_SHAREDMEM_SUPPORT), Y)
115
DEFINES += -DHAVE_SHAREDMEM_SUPPORT=1
116
endif
117
 
118
ifeq ($(SHAREDLIBS), Y)
119
CFLAGS += -fpic
120
endif
121
 
122
ifeq ($(OPTIMIZE), Y)
123
OPTFLAGS += -O3
124
endif
125
 
126
ifeq ($(DEBUG), Y)
127
OPTFLAGS += -ggdb
128
else
129
#OPTFLAGS += -DNDEBUG
130
endif
131
 
132
CFLAGS += $(INCLUDEDIRS)
133
HOSTCFLAGS := $(CFLAGS)
134
CPPFLAGS += $(DEFINES)
135
LDFLAGS += -L$(TOP)/lib
136
ARFLAGS = rs
137
 
138
# Tools (may be overridden by Arch.rules)
139
HOSTCC = gcc
140
COMPILER = gcc
141
CXX_COMPILER = g++
142
ACHIVER = ar
143
LINKER = ld
144
 
145
# Include the rules for arch's
146
# if the user has a specific arch local to their home load it
147
ifeq ($(HOME)/microwin/Arch.rules,$(wildcard $(HOME)/microwin/Arch.rules))
148
include $(HOME)/microwin/Arch.rules
149
else
150
include $(TOP)/Arch.rules
151
endif
152
 
153
# Tools ...
154
CC = $(TOOLSPREFIX)$(COMPILER)
155
CXX = $(TOOLSPREFIX)$(CXX_COMPILER)
156
AR = $(TOOLSPREFIX)$(ACHIVER)
157
LD = $(TOOLSPREFIX)$(LINKER)
158
NM = $(TOOLSPREFIX)nm
159
STRIP = $(TOOLSPREFIX)strip
160
OBJCOPY = $(TOOLSPREFIX)objcopy
161
CP = cp
162
MV = mv
163
 
164
################## Libraries Section ##################
165
 
166
MWINLIBS = $(TOP)/lib/libmwin.a $(TOP)/lib/libmwinlib.a\
167
        $(TOP)/lib/libmwengine.a $(TOP)/lib/libmwdrivers.a\
168
        $(TOP)/lib/libmwfonts.a $(TOP)/lib/libmwimages.a
169
CCMWINLIBS = -lmwin -lmwinlib -lmwengine -lmwdrivers -lmwfonts -lmwin -lmwimages -lm
170
 
171
ifeq ($(NWIDGET), Y)
172
NANOXCLIENTLIBS += $(TOP)/lib/libnwidget.a
173
#ifeq ($(LINK_APP_INTO_SERVER), Y)
174
#NANOXSERVERLIBS += $(TOP)/lib/libnwidget.a
175
#endif
176
endif
177
 
178
ifeq ($(LINK_APP_INTO_SERVER), Y)
179
NANOXCLIENTLIBS += $(TOP)/lib/libnano-X.a $(TOP)/lib/libmwengine.a\
180
        $(TOP)/lib/libmwdrivers.a $(TOP)/lib/libmwfonts.a
181
CCNANOXCLIENTLIBS += -lnano-X -lmwengine -lmwdrivers -lmwfonts
182
else
183
NANOXCLIENTLIBS += $(TOP)/lib/libnano-X.a
184
CCNANOXCLIENTLIBS += -lnano-X
185
endif
186
 
187
NANOXSERVERLIBS += $(TOP)/lib/libmwengine.a $(TOP)/lib/libmwdrivers.a\
188
        $(TOP)/lib/libmwfonts.a
189
CCNANOXSERVERLIBS += -lmwengine -lmwdrivers -lmwfonts
190
 
191
ifeq ($(HAVE_FILEIO), Y)
192
ifeq ($(HAVE_JPEG_SUPPORT), Y)
193
MWINLIBS += $(LIBJPEG)
194
CCMWINLIBS += $(LIBJPEG)
195
NANOXLIBS += $(LIBJPEG)
196
NANOXSERVERLIBS += $(LIBJPEG)
197
ifeq ($(SHAREDLIBS), Y)
198
        CCNANOXSERVERLIBS += $(LIBJPEG)
199
endif
200
ifeq ($(LINK_APP_INTO_SERVER), Y)
201
        NANOXCLIENTLIBS += $(LIBJPEG)
202
endif
203
endif
204
ifeq ($(HAVE_PNG_SUPPORT), Y)
205
MWINLIBS += $(LIBPNG) $(LIBZ)
206
CCMWINLIBS += $(LIBPNG) $(LIBZ)
207
NANOXLIBS += $(LIBPNG) $(LIBZ)
208
NANOXSERVERLIBS += $(LIBPNG) $(LIBZ)
209
ifeq ($(SHAREDLIBS), Y)
210
        CCNANOXSERVERLIBS += $(LIBPNG) $(LIBZ)
211
endif
212
ifeq ($(LINK_APP_INTO_SERVER), Y)
213
        NANOXCLIENTLIBS += $(LIBPNG) $(LIBZ)
214
endif
215
endif
216
 
217
endif
218
 
219
ifeq ($(HAVE_T1LIB_SUPPORT), Y)
220
MWINLIBS += $(LIBT1LIB)
221
CCMWINLIBS += $(LIBT1LIB)
222
NANOXLIBS += $(LIBT1LIB)
223
NANOXSERVERLIBS += $(LIBT1LIB)
224
ifeq ($(SHAREDLIBS), Y)
225
        CCNANOXSERVERLIBS += $(LIBT1LIB)
226
endif
227
ifeq ($(LINK_APP_INTO_SERVER), Y)
228
        NANOXCLIENTLIBS += $(LIBT1LIB)
229
endif
230
LDFLAGS += -lm
231
endif
232
 
233
ifeq ($(HAVE_FREETYPE_SUPPORT), Y)
234
MWINLIBS += $(LIBFTLIB)
235
CCMWINLIBS += $(LIBFTLIB)
236
NANOXLIBS += $(LIBFTLIB)
237
NANOXSERVERLIBS += $(LIBFTLIB)
238
ifeq ($(SHAREDLIBS), Y)
239
        CCNANOXSERVERLIBS += $(LIBFTLIB)
240
endif
241
ifeq ($(LINK_APP_INTO_SERVER), Y)
242
        NANOXCLIENTLIBS += $(LIBFTLIB)
243
endif
244
LDFLAGS += -lm
245
endif
246
 
247
ifeq ($(ARCH), ELKS)
248
CCMWINLIBS = $(MWINLIBS)
249
CCNANOXLIBS = $(NANOXLIBS)
250
endif
251
 
252
ifeq ($(ARCH), DJGPP)
253
CCMWINLIBS += -lgrx20
254
CCNANOXLIBS = $(NANOXLIBS)
255
NANOXCLIENTLIBS += -lgrx20
256
endif
257
 
258
################## End of Libraries Section ##################
259
 
260
# If you dont want to see every executed command ...
261
ifeq ($(VERBOSE), N)
262
.SILENT:
263
endif
264
 
265
.PHONY: default subdirs clean cleandepend xconfig
266
 
267
# Add any exportable variable here
268
export TOP ARCH CONFIG
269
 
270
#
271
# This is the default target
272
# It looks for sub-directories with makefiles in it and tries to execute them
273
#
274
ifeq ($(SHAREDLIBS), Y)
275
default: subdirs $(OBJS) $(CXXOBJS) $(TOP)/lib/$(LIBNAME) $(TOP)/lib/$(LIBNAMESO)
276
else
277
default: subdirs $(OBJS) $(CXXOBJS) $(ASMOBJS) $(TOP)/lib/$(LIBNAME)
278
endif
279
 
280
# 'dirs' can be pre-specified
281
ifeq ($(dirs), )
282
dirs =  $(shell for file in `\ls`; \
283
        do if [ -d $$file -a $$file != "demos" ]; then \
284
        if [ -f $$file/Makefile ]; then echo $$file; fi; fi; done)
285
endif
286
 
287
# 'demos' can be pre-specified
288
ifeq ($(demos), )
289
demos = $(shell for file in `\ls`; \
290
        do if [ -d $$file -a $$file = "demos" ]; then \
291
        if [ -f $$file/Makefile ]; then echo $$file; fi; fi; done)
292
endif
293
 
294
#
295
# Subdirectories target
296
#
297
subdirs:
298
ifeq ($(ARCH), DJGPP)
299
 
300
        $(shell set CURDIR=$(pwd);)
301
 
302
        $(shell \
303
        if [ ! -d $(TOP)/bin ]; \
304
        then mkdir $(TOP)/bin; fi;)
305
 
306
        $(shell \
307
        if [ ! -d $(TOP)/lib ]; \
308
        then mkdir $(TOP)/lib; fi;)
309
 
310
endif
311
        $(foreach dir, $(dirs), $(MAKE) -C $(dir);)
312
 
313
#
314
# If a library name is specified,
315
# a library of that name will be created with objects in that directory
316
#
317
ifneq ($(LIBNAME), )
318
$(TOP)/lib/$(LIBNAME): $(OBJS) $(CXXOBJS)
319
        @echo "Creating library $@ ..."
320
        $(AR) $(ARFLAGS) $(TOP)/lib/$(LIBNAME) $(OBJS) $(CXXOBJS) $(ASMOBJS)
321
endif
322
 
323
#
324
# If a shared object library name is specified, link this object
325
#
326
ifeq ($(SHAREDLIBS), Y)
327
$(TOP)/lib/$(LIBNAMESO): $(TOP)/lib/$(LIBNAME)
328
        @echo "Creating shared library $@ ..."
329
        $(LD) -shared -o $@ --whole-archive $^
330
endif
331
 
332
#
333
# Dependencies target for C files
334
#
335
.depend: $(OBJS:.o=.c) $(CXXOBJS:.o=.cc)
336
        @echo "Updating dependencies in $(CURDIR) ..."
337
        $(SHELL) -ec '$(HOSTCC) -MM $(CPPFLAGS) $(HOSTCFLAGS) $(OBJS:.o=.c) \
338
        | sed '\''s/\($*\)\.o[ :]*/\1.o \$@ : $$(TOP)\/config /g'\'' > $@; \
339
        [ -s $@ ] || rm -f $@'
340
 
341
#
342
# Compilation target for C files
343
#
344
%.o:%.c
345
        @echo "Compiling $< ..."
346
        $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
347
 
348
 
349
#
350
# Compilation target for C++ files
351
#
352
%.o:%.cc
353
        @echo "C++ compiling $< ..."
354
        $(CXX) -c $(CFLAGS) $(CXXFLAGS) -o $@ $<
355
 
356
#
357
# Compilation target for bmp file conversion
358
#
359
%.c:%.bmp $(TOP)/mwin/bmp/convbmp.c
360
        echo "Generating $@ from bitmap file ..."
361
        $(TOP)/bin/convbmp $< > $@
362
 
363
xconfig:
364
        ./xconfigure
365
 
366
# don't clean lib dir
367
cleanapps: cleandepend
368
        @echo "Cleaning directory $(CURDIR) ..."
369
        $(RM) core *~ *.bak *.o TAGS
370
        $(RM) bin/*
371
        $(foreach dir, $(dirs), $(MAKE) -C $(dir) cleanapps;)
372
        $(foreach dir, $(demos), $(MAKE) -C $(dir) cleanapps;)
373
 
374
clean: cleandepend
375
        @echo "Cleaning directory $(CURDIR) ..."
376
        $(RM) core *~ *.bak *.o TAGS
377
        $(RM) $(TOP)/lib/*.a $(TOP)/lib/*.so
378
        $(shell cd $(TOP)/bin; \
379
                for file in `\ls`; do if [ ! -d $$file ]; \
380
                then $(RM) $$file; fi; done; cd $(TOP))
381
        $(foreach dir, $(dirs), $(MAKE) -C $(dir) clean;)
382
        $(foreach dir, $(demos), $(MAKE) -C $(dir) clean;)
383
 
384
 
385
cleandepend:
386
        @echo "Cleaning dependencies in directory $(CURDIR) ..."
387
        $(RM) .depend
388
        $(foreach dir, $(dirs), $(MAKE) -C $(dir) cleandepend;)
389
        $(foreach dir, $(demos), $(MAKE) -C $(dir) cleandepend;)
390
 
391
install: default
392
        $(INSTALL_DIR) $(HDRINSTALLDIR)
393
        echo "Copying hdrs to $(HDRINSTALLDIR)"
394
        $(INSTALL_HDR) include/*.h $(HDRINSTALLDIR)
395
        echo "Copying libs to $(LIBINSTALLDIR)"
396
        $(INSTALL_DIR) $(LIBINSTALLDIR)
397
        $(INSTALL_LIB) lib/*.a $(LIBINSTALLDIR)
398
ifeq ($(SHAREDLIBS), Y)
399
        $(INSTALL_LIB) lib/*.so $(LIBINSTALLDIR)
400
endif
401
        echo "Installation completed successfully."
402
 
403
tags:
404
        -rm -f TAGS
405
        etags --language=c++ --append \
406
                `find . \( -name '*.h' -o -name '*.cc' \) -print`
407
        etags --language=c --append `find . -name \*.[hc] -print`
408
        etags --language=asm --append `find . -name \*.[Ss] -print`
409
 
410
#
411
# Included dependency files
412
#
413
ifneq ($(MAKECMDGOALS), clean)
414
ifneq ($(MAKECMDGOALS), cleandepend)
415
ifneq ($(MAKECMDGOALS), realclean)
416
ifneq ($(MAKECMDGOALS), xconfig)
417
ifneq ($(OBJS),)
418
-include .depend
419
endif
420
endif
421
endif
422
endif
423
endif
424
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.