File: Makefile.Linux

package info (click to toggle)
euslisp 9.32%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 54,988 kB
  • sloc: ansic: 41,639; lisp: 3,339; makefile: 286; sh: 238; asm: 138; python: 53
file content (157 lines) | stat: -rw-r--r-- 5,034 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
# makefile for EusLisp on sun4 with SunOS (Solaris)
# RCSid="@(#)$Id$"
#	Copyright (1988) Toshihiro MATSUI, Electrotechnical Laboratory
#	1989/Oct
#	1990/Sep Second Tape Distribution
#	KOBJECTS --- eus kernel objects written in C
#	NOKOBJECTS-- eus kernel, but cannot be optimized with -O option
#	CLIBOBJECTS- functions written in C, not members of kernel
#	LOBJECTS --- functions coded in EUSLISP; must be compiled with euscomp
#	GEOOBJECTS-- geometric modeling functions and classes
#	XOBJECTS---- Xwindow interface
#	XTKOBJECTS---- Xwindow interface
#	IMGOBJECTS--- image processing
#	MTOBJECTS--- multithread functions
#
#########################################################################
# Customizable section begins
#########################################################################

ARCH=Linux
include Makefile.generic1

THREAD= -DTHREADED -DPTHREAD
MFLAGS=
XVERSION=X_V11R6_1

#
# Select CFLAGS and XVERSION according to the version of SunOS and Xlib.
#
# for Linux

GCC_MAJOR_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\+\).*/\1/')
GCC_MINOR_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\+\).*/\2/')
# GCC_PATCH_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\3/')
ifneq (,$(findstring 64,$(shell gcc -dumpmachine)))
ifeq ($(GCC_MAJOR_VERSION), 2)
 ALIGN_FUNCTIONS="-malign-functions=8"
else
 ALIGN_FUNCTIONS=-falign-functions=8
 GCC3=-DGCC3
endif
else
ifeq ($(GCC_MAJOR_VERSION), 2)
 ALIGN_FUNCTIONS="-malign-functions=4"
else
 ALIGN_FUNCTIONS=-falign-functions=4
 GCC3=-DGCC3
endif
endif

ADD_LDFLAGS=
ifneq (,$(findstring t,$(shell if [ \( $(GCC_MAJOR_VERSION) -eq 4 -a $(GCC_MINOR_VERSION) -ge 5 \) -o  $(GCC_MAJOR_VERSION) -ge 5 ] ; then echo t ;fi )))
ADD_LDFLAGS += -Wl,--no-as-needed
endif

# set CPU arch with -D
GCC_MACHINE=$(shell gcc -dumpmachine)
$(info "-- GCC_MACHINE = ${GCC_MACHINE}")
ifneq ($(GCC_MACHINE),)
 ifneq (,$(findstring x86_64-linux-gnu,$(GCC_MACHINE)))
   MACHINE=x86_64
 else ifneq (,$(findstring i686-linux-gnu,$(GCC_MACHINE)))
   MACHINE=i686
 else ifneq (,$(findstring aarch64-linux-gnu,$(GCC_MACHINE)))
   MACHINE=aarch64
 else ifneq (,$(findstring arm-linux-gnu,$(GCC_MACHINE)))
   MACHINE=arm
 else ifneq (,$(findstring powerpc64le-linux-gnu,$(GCC_MACHINE)))
   MACHINE=ppc64le
 else ifneq (,$(findstring mips64el-linux-gnu,$(GCC_MACHINE)))
   MACHINE=mips64
 else
   MACHINE=$(subst -linux-gnu,,$(GCC_MACHINE))
 endif
else
 MACHINE=$(shell uname -m)
endif
# need to set 'i486', for conditionals in c/*.[ch].
ifneq ($(shell gcc -dumpmachine | grep "i.*86-linux"),)
  MACHINE=i486
endif

DEBUG= # -g


# If you use libc.so.5, remove -DLIB6 option.
# If you use old linux that does not know mallopt, add -OLD_LINUX option.

CFLAGS:= $(CFLAGS) $(CPPFLAGS) $(WFLAGS) -D$(MACHINE) -DLinux -D_REENTRANT -DVERSION=\"$(VERSION)\" \
	-DLIB6 $(ALIGN_FUNCTIONS) -fsigned-char -fno-stack-protector \
        $(DEBUG) $(CPU_OPTIMIZE) $(THREAD) -D$(XVERSION) \
	-DGCC $(GCC3) \
	        -I/usr/include -I/usr/X11R6/include -I$(EUSDIR)/include

# machine specific CFLAGS
ifneq ($(shell gcc -dumpmachine | egrep "^(arm|aarch)"),)
  ADD_LDFLAGS+=-Wl,-z,execstack
  CFLAGS+=-DARM -fPIC
  ARCH=LinuxARM
endif
ifneq ($(shell gcc -dumpmachine | grep "^x86_64"),)
  CFLAGS+=-fPIC
  ARCH=Linux64
endif

# Use gcc for C-compiling on SunOS4. Sun's cc is ok on Solaris.
# /usr/ucb/cc cannot compile because of its incapability of recognizing
# prototype declarations.
CC=cc
LD=ld

#
# L I B R A R I E S
# Three kinds of libraries are needed to build eus.
# 1. RAWLIB: unix libraries needed to make eus0-eus2
# 2. XLIB: X window libraries
#    When you use a window toolkit, you may need to override the 'read'
#    function in libc.a with a specific window library such as libXview.a.
# 3. EUSLIB: euslisp functions that cannot be linked in eus because of
#    'GLOBAL OFFSET TABLE OVERFLOW', that are xwindow interface functions.
# You may add any optional user-supplied library in EUSLIB.
# On Solaris, XLIB and EUSLIB are combined together into lib/libeusx.so.

# Linux
RAWLIB=-ldl -lm -lpthread -lc
XLIB= -L/usr/X11R6/lib -lX11

# specify directories where euslisp's libraries are located.
EUSRPATH=-R$(ADLIBDIR):$(EUSDIR)/lib/Linux
EUSLIB= -Xlinker $(EUSRPATH) -L$(ADLIBDIR)
GLLIB= -L$(ADLIBDIR) -lGLU -lGL -lXext

# POSIX Thread
THREADDEP=mthread_posix.c
#THREADDEP=pthreads.c

# If you don't like optimization, comment out the next line.
OFLAGS=-O2

# link-editor's default flags ?-rdynamic
SOFLAGS:= $(LDFLAGS) -shared -Xlinker -build-id
LD=gcc
LDFLAGS:= $(LDFLAGS) -rdynamic -fno-stack-protector -z execstack $(ADD_LDFLAGS)
MTCOBJECTS= $(OBJDIR)/mthread.o $(OBJDIR)/mthread_posix.o
#MTCOBJECTS= $(OBJDIR)/mthread.o $(OBJDIR)/pthreads.o
MAPOPTION=  $(OBJDIR)/par.o


#################################################################
# end of the customizable section
################################################################

include Makefile.generic2

eusjpeg:
	make -C image/jpeg/ ARCHDIR=$(ARCH) EUSDIR=$(EUSDIR)