-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
131 lines (105 loc) · 3.27 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
# IGL makefile
#
# usage: IRIX: make MIPSABI={32|n32} LIBDIR={lib|lib32} install
# x86 linux: make ABI=-m32 install
INCDIR=include
SRCDIR=src
EXAMPLEDIR=examples
LIBDIR?=lib
MIPSABI=32
ABI?=-mabi=$(MIPSABI)
INSTALLDIR?=/usr/local
# gcc
GCCPREFIX?=$(BASE)/igcc/usr/tgcware/gcc45/bin/
CC=$(GCCPREFIX)gcc $(ABI)
LD=$(GCCPREFIX)gcc $(ABI)
CFLAGS+=-DDEBUG # debug output
CFLAGS+=-g3 -Wall # debug version
CFLAGS+=-O3 # release version
LDFLAGS=-shared
# MIPSpro 7.4 on IRIX
#IDOPREFIX?=$(BASE)/iido/usr/bin/
#CC=$(IDOPREFIX)cc -$(MIPSABI)
#LD=$(IDOPREFIX)ld -$(MIPSABI)
#CFLAGS+=-Dinline= # unsupported
#CFLAGS+=-g3 # debug version
#CFLAGS+=-O2 # release version
#LDFLAGS=-shared
LN=ln
AR=ar
RANLIB=ranlib
INCLUDES=-I$(INCDIR)
LIBS=-lGL -lGLU -lX11 -lXext -lm -lc
LIBGL_INIT=-Wl,-init,_igl_init
LIBGL_OBJS=$(LIBDIR)/buffer.o \
$(LIBDIR)/color.o \
$(LIBDIR)/device.o \
$(LIBDIR)/draw.o \
$(LIBDIR)/grpos.o \
$(LIBDIR)/igl.o \
$(LIBDIR)/light.o \
$(LIBDIR)/matrix.o \
$(LIBDIR)/menu.o \
$(LIBDIR)/object.o \
$(LIBDIR)/objapi.o \
$(LIBDIR)/pixel.o \
$(LIBDIR)/pixmode.o \
$(LIBDIR)/texture.o \
$(LIBDIR)/vertex.o \
$(LIBDIR)/window.o \
$(LIBDIR)/fortran.o
LIBFM_OBJS = $(LIBDIR)/fontmgr.o
LIBFGL_OBJS = $(LIBDIR)/fgl.o
LIB_OBJS = $(LIBGL_OBJS) $(LIBFM_OBJS) $(LIBFGL_OBJS)
EXAMPLE_OBJS=$(EXAMPLEDIR)/demo1.o \
$(EXAMPLEDIR)/demo2.o \
$(EXAMPLEDIR)/demo3.o \
$(EXAMPLEDIR)/demo4.o \
$(EXAMPLEDIR)/demo5.o
#
# targets
#
LIBGL_SHARED=$(LIBDIR)/libgl.so
LIBGL_STATIC=$(LIBDIR)/libgl.a
LIBFM_SHARED=$(LIBDIR)/libfm.so
LIBFM_STATIC=$(LIBDIR)/libfm.a
LIBFGL_STATIC=$(LIBDIR)/libfgl.a
EXAMPLES=$(EXAMPLEDIR)/demo1 $(EXAMPLEDIR)/demo2 $(EXAMPLEDIR)/demo3 $(EXAMPLEDIR)/demo4 $(EXAMPLEDIR)/demo5
STATIC=$(LIBGL_STATIC) $(LIBFM_STATIC) $(LIBFGL_STATIC)
SHARED=$(LIBGL_SHARED) $(LIBFM_SHARED)
igl: $(LIBDIR) $(SHARED) $(STATIC)
shared: $(LIBDIR) $(SHARED)
static: $(LIBDIR) $(STATIC)
examples: $(EXAMPLES)
all: igl examples
install: igl
mkdir -p $(INSTALLDIR)/$(LIBDIR)
cp $(SHARED) $(STATIC) $(INSTALLDIR)/$(LIBDIR)
mkdir -p $(INSTALLDIR)/$(INCDIR)/igl
cp $(INCDIR)/igl.h $(INCDIR)/ifm.h $(INSTALLDIR)/$(INCDIR)/igl
cp $(INCDIR)/gl.h $(INCDIR)/device.h $(INCDIR)/fmclient.h $(INSTALLDIR)/$(INCDIR)
$(LIBDIR):
mkdir -p $(LIBDIR)
$(LIBGL_OBJS) $(LIBFM_OBJS) $(LIBFGL_OBJS): $(LIBDIR)/%.o: $(SRCDIR)/%.c $(INCDIR)/*.h
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
$(LIBGL_SHARED): $(LIBGL_OBJS)
$(LD) $(LDFLAGS) $(LIBS) $(LIBGL_OBJS) -o $@ $(LIBGL_INIT)
$(LIBGL_STATIC): $(LIBGL_OBJS)
$(AR) cru $@ $(LIBGL_OBJS)
$(RANLIB) $@
$(LIBFGL_STATIC): $(LIBFGL_OBJS)
$(AR) cru $@ $(LIBFGL_OBJS)
$(RANLIB) $@
$(LIBFM_SHARED): $(LIBFM_OBJS)
$(LD) $(LDFLAGS) $(LIBS) $(LIBFM_OBJS) -o $@
$(LIBFM_STATIC): $(LIBFM_OBJS)
$(AR) cru $@ $(LIBFM_OBJS)
$(RANLIB) $@
$(EXAMPLE_OBJS): $(EXAMPLEDIR)/%.o: $(EXAMPLEDIR)/%.c
@$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
$(EXAMPLES): %: %.o $(SHARED)
@$(LD) [email protected] -o $@ -L$(LIBDIR) -lgl $(LIBS)
clean:
@rm -f $(LIB_OBJS) $(SHARED) $(STATIC)
@rm -f $(EXAMPLE_OBJS) $(EXAMPLES)
@echo DONE