summaryrefslogtreecommitdiff
path: root/support/latexdraw/Makefile
blob: 8251da474774bcec5006df3af7fa8fbc3ba69b64 (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
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# makefile for latexdraw, Stand 19.10.1995/23.12.1996/13.4.98/3.7.98/28.2.99
# latexdraw is compiled and all files installed
# use
# for hp-ux:       make installhp
# for sun solaris: make installsun
# for freebsd:     make installfreebsd
# for linux:       make installlinux
#
################################################################################
# you may want to change some of the following definitions for your installation
################################################################################

# directory prefix
PREFIX = /usr/local

# directory for binaries
BINDIR = $(PREFIX)/bin
SUNBINDIR = $(BINDIR)
HPBINDIR = $(BINDIR)
FREEBINDIR = $(BINDIR)
LINUXBINDIR = $(BINDIR)

# directory for style files
STYLEDIR = $(PREFIX)/teTeX/texmf/tex/lib/inputs/latexdraw
SUNSTYLEDIR = $(STYLEDIR)
HPSTYLEDIR = $(STYLEDIR)
FREESTYLEDIR = $(STYLEDIR)
LINUXSTYLEDIR = $(STYLEDIR)

# directory for man page
MANDIR = $(PREFIX)/teTeX/texmf/tex/man/man1
SUNMANDIR = $(MANDIR)
HPMANDIR = $(MANDIR)
FREEMANDIR = $(MANDIR)
LINUXMANDIR = $(MANDIR)

# directory for documenation
DOCDIR = $(PREFIX)/teTeX/texmf/tex/lib/inputs/latexdraw/doc
SUNDOCDIR = $(DOCDIR)
HPDOCDIR = $(DOCDIR)
FREEDOCDIR = $(DOCDIR)
LINUXDOCDIR = $(DOCDIR)

# compiler
CC = gcc

#thread path
SUNTHREAD_DIR   = /usr
HPTHREAD_DIR    = /usr/local/robotik/DIR/dce-threads
FREETHREAD_DIR  = /usr
LINUXTHREAD_DIR = /usr


# include directory
INC_DIR  =  -I/usr/local/include -I/usr/local/include/X11 \
            -I/usr/include -I/usr/include/X11 \
            -I/usr/X11R6/include -I/usr/X11R6/include/X11 \
            -I/usr/include/X11R5 -I/usr/include/X11R5/X11

SUNINC_DIR    =  $(INC_DIR) -I$(SUNTHREAD_DIR)/include
HPINC_DIR     =  $(INC_DIR) -I$(HPTHREAD_DIR)/include
FREEINC_DIR   =  $(INC_DIR) -I$(FREETHREAD_DIR)/include
LINUXINC_DIR  =  $(INC_DIR) -I$(LINUXTHREAD_DIR)/include

#lib path and libs
LIB_DIR  = -L/usr/local/lib -L/usr/lib -L/usr/ccs/lib -L/usr/X11R6/lib
SUNLIB_DIR    = $(LIB_DIR) -L$(SUNTHREAD_DIR)/lib
HPLIB_DIR     = $(LIB_DIR) -L$(HPTHREAD_DIR)/lib
FREELIB_DIR   = $(LIB_DIR) -L$(FREETHREAD_DIR)/lib
LINUXLIB_DIR  = $(LIB_DIR) -L$(LINUXTHREAD_DIR)/lib

#compile without threads
SUNLIBS    = -lX11 -lm -lc -lnsl -lsocket
SUNTHREADFLAG =
HPLIBS     = -lX11 -lm -lc
HPTHREADFLAG =
FREELIBS   = -lX11 -lm -lc
FREETHREADFLAG =
LINUXLIBS  = -lX11 -lm -lc
LINUXTHREADFLAG =

#compile with threads (uncomment if compilation with threads)
#SUNLIBS    = -lX11 -lm -lc_r -lnsl -lsocket
#SUNTHREADFLAG = -DTHREAD
HPLIBS     = -lX11 -lm -ldce -lc_r 
HPTHREADFLAG = -DTHREAD
FREELIBS   = -lX11 -lm -lc_r
FREETHREADFLAG = -DTHREAD
#LINUXLIBS  = -lX11 -lm -lc -lpthread
#LINUXTHREADFLAG = -DTHREAD

################################################################################
# do not change the following definitions
################################################################################

# Name of source-file without extension .c
L = latexdraw

# digitizer not included
DIGI_H = 
DIGI_C =
DIGIFLAG= 

# digitizer included
# DIGI_H = digitizer.h
# DIGI_C = digitizer.c
# DIGIFLAG= -DTABLETT

# compile for SUNSolaris
sunbin solarisbin: 
	$(CC) $(SUNINC_DIR) $(DIGIFLAG) $(SUNTHREADFLAG) -DSUN -o $(L) $(L).c \
	      $(DIGI_C) $(SUNLIB_DIR) $(SUNLIBS)

# compile for HPUX
hpbin hpuxbin: 
	$(CC) $(HPINC_DIR) $(DIGIFLAG) $(HPTHREADFLAG) -DHPUX -o $(L) $(L).c \
	      $(DIGI_C) $(HPLIB_DIR) $(HPLIBS)

# compile for freeBSD 
freebin freebsdbin: 
	$(CC) $(FREEINC_DIR) $(DIGIFLAG) $(FREETHREADFLAG) -DFREE -o $(L) $(L).c \
	      $(DIGI_C) $(FREELIB_DIR) $(FREELIBS)

# compile for linux 
linuxbin:
	$(CC) $(LINUXINC_DIR) $(DIGIFLAG) $(LINUXTHREADFLAG) -DLINUX -o $(L) $(L).c \
	      $(DIGI_C) $(LINUXLIB_DIR) $(LINUXLIBS)

# create compressed tar-file (latexdraw-<majorVersion>.<minorVersion>)
tar:  
	awk 'BEGIN{LName="$(L)"; gef = 0;\
	  x= "#define window_name   \"LaTeXdraw (Siegert, TUM, C";\
	  lx=length(x);}\
	 {if (gef == 1) next; \
	  if (substr($$0,1,lx) != x) next;\
	  fin=match($$0,"\\)"); \
	  LName= LName "-" substr($$0,lx+1,fin-1-lx) ".tar";\
	  gef = 1; next;\
	  }END{ \
	tarcommand = "tar -cf " LName " bin  digitizer doc $(L).c ";\
	tarcommand = tarcommand " Makefile man test texinputs";\
	system(tarcommand);\
	zipcommand = "gzip -f " LName;\
	system(zipcommand);\
	}' < $(L).c 

extract:
	ls -1A $(L)*.tar.gz | \
	awk 'BEGIN{Vers1=-1; Vers2=0; Lname="$(L)"; lL=length(Lname);}\
	 {if (length == 0) next;\
	 Vers = substr($$0,lL+1,length-7); lVers = length(Vers);\
	 if (lVers==0) next;\
	 if (substr(Vers,1,1) != "-") next;\
	 point = match(Vers,"[.]");\
	 Vers1n = substr(Vers,2,point-1)+0;\
	 Vers2n = substr(Vers,point+1,lVers)+0;\
	 if ( (Vers1n > Vers1) || ((Vers1n == Vers1)&&(Vers2n>Vers2)) ) {\
	  Vers1=Vers1n; Vers2 = Vers2n; Lname = substr($$0,1,length-7);}\
	 }END{\
	 unzipcommand = "gunzip " Lname ".tar.gz";\
	 extractcommand = "tar -xf " Lname ".tar";\
	 zipcommand = "gzip " Lname ".tar";\
	 system(unzipcommand);\
	 system(extractcommand);\
	 system(zipcommand);\
	 }'

# compile and install latexdraw for SUN Solaris from compressed tar-file!!!
installsun suninstall:
	make extract
	make sunbin
	cp $(L) bin/* $(SUNBINDIR)
	cp -r doc/* $(SUNDOCDIR)
	cp  man/man1/* $(SUNMANDIR)
	cp texinputs/* $(SUNSTYLEDIR)


# compile and install latexdraw for HPUX from compressed tar-file!!!
installhp hpinstall:
	make extract
	make hpbin
	cp $(L) bin/* $(HPBINDIR)
	cp -r doc/* $(HPDOCDIR)
	cp  man/man1/* $(HPMANDIR)
	cp texinputs/* $(HPSTYLEDIR)

# compile and install latexdraw for freeBSD from compressed tar-file!!!
installfreebsd installfreeBSD freebsdinstall freeBSDinstall:
	make extract
	make freebin
	cp $(L) bin/* $(FREEBINDIR)
	cp -r doc/* $(FREEDOCDIR)
	cp  man/man1/* $(FREEMANDIR)
	cp texinputs/* $(FREESTYLEDIR)

# compile and install latexdraw for Linux from compressed tar-file!!!
installlinux linuxinstall:
	make extract
	make linuxbin
	cp $(L) bin/* $(LINUXBINDIR)
	cp -r doc/* $(LINUXDOCDIR)
	cp  man/man1/* $(LINUXMANDIR)
	cp texinputs/* $(LINUXSTYLEDIR)


##############################################################
# following parts only for internal use by siegert
##############################################################

atbin:
	make freebin
	cp texinputs/* $$HOME/latex

# support to include colors
farben:
	awk 'BEGIN{print "Farben nach rgb.txt fuer Ergaenzung latexdraw";}\
	    {printf("  eintragefarbname(&nr, \"%s\");\n",$$4);}'\
	    rgb.txt >rgb.tmp1
	awk 'BEGIN{print "Farben nach rgb.txt fuer Ergaenzung latexdraw.sty";}\
	    {printf(" %.2f %.2f %.2f \\sc@ \\or%% %d %d %d %s\n",\
	    $$1/255,$$2/255,$$3/255,$$1,$$2,$$3,$$4);}' rgb.txt >rgb.tmp2
	awk 'BEGIN{print "Farben nach rgb.txt fuer allecolors.tex";}\
	    {printf("\\sample{%.2f}{%.2f}{%.2f}{%s}\n",$$1/255,$$2/255,$$3/255,$$4);}'\
	    rgb.txt >rgb.tmp3

# show testcase with number immediately following test, e.g. make test17
test%:
	cp -p abbtest/$@.tex ./
	latex $@
	rm $@.ps
	dvips $@.dvi >$@.ps;\
	ghostview -a4 -magstep -2 $@.ps
	rm $@.*

#####Ende Makefile#######