File: Makefile

package info (click to toggle)
wings3d 2.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,404 kB
  • sloc: erlang: 132,169; ansic: 3,779; lisp: 1,434; sh: 805; makefile: 794; cpp: 244; xml: 50
file content (129 lines) | stat: -rw-r--r-- 3,084 bytes parent folder | download | duplicates (2)
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
#
#  Makefile --
#
#     Makefile for building Wings "accelerator" helpers.
#
#  Copyright (c) 2004-2013 Bjorn Gustavsson
#
#  See the file "license.terms" for information on usage and redistribution
#  of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
#     $Id: Makefile,v 1.11 2006/01/14 09:02:38 dgud Exp $
#
include ../erl.mk

OS := $(shell uname -s)

LIBDIR = ../priv

ifeq ($(findstring CYGWIN,$(OS)),CYGWIN)
  USEMINGWGCC := true
  DEF_CC = mingw32-gcc
endif

ifdef MSYSTEM
 ifeq ($(MSYSTEM),$(filter $(MSYSTEM),MINGW32 MINGW64))
  USEMINGWGCC := true
  DEF_CC = gcc
 endif
else
 ifeq ($(WSLcross), true)
  UseMCL = true
 endif
endif

## UseMCL := $(shell cl.exe 2>&1 | grep Microsoft)

ifneq (x$(UseMCL),x)
  UseMCL = true
  USEMINGWGCC = false
  DEF_CC = cl.exe
endif

FRD = 'io:fwrite("~n=:~s~n",[code:root_dir()]),init:stop().'
ERL_DIR := $(shell echo $(FRD) | $(ERL) | sed -n '/^=:/s/^=://p')
ERL_INC = "$(ERL_DIR)/usr/include"

WORDSIZE := $(shell $(ERL) -noinput -eval 'io:format("~w~n", [erlang:system_info(wordsize)*8]),init:stop()')

UNIVERSAL_FLAGS =
COMMON_CFLAGS = -g

ifeq ($(UseMCL),true)
 OUT = -Fe:
 OUT_OBJ = -Fo
 OBJ = obj
 SO_EXT = dll
 LIBS = -LD
 DEBUG = -Fd$@.pdb
 CFLAGS += -nologo -Zi -Ox -FS -MP -D__WIN32__
 CXXFLAGS += $(CFLAGS) -EHsc
else
 OUT = -o
 OUT_OBJ = -o
 OBJ = o
 CFLAGS += $(COMMON_CFLAGS) -O3 -fPIC
 CXXFLAGS += -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-switch

 ifdef USEMINGWGCC
  SO_EXT = dll
  LIBS = -mdll
 else
  SO_EXT = so
  DEF_CC = $(CC)
  ifeq ($(OS),Darwin)
    CFLAGS = $(UNIVERSAL_FLAGS) $(COMMON_CFLAGS) -O3
    LIBS = $(UNIVERSAL_FLAGS) -bundle -flat_namespace -undefined suppress
    CXXFLAGS += $(CFLAGS) -std=c++14
  else
    LIBS = -shared
    CXX_LD = -lstdc++
    CXXFLAGS += $(CFLAGS)
  endif
 endif
endif

ifeq ($(GCC),)
    GCC = $(DEF_CC)
endif

IGL_INCLUDE = -I../_deps/eigen -I../_deps/libigl/include

TESS_SRC = dict geom memalloc mesh normal priorityq render sweep tess tessmono
TESS_HEADER = $(TESS_SRC) priorityq-sort dict-list priorityq-heap

# TESS_SRC_FILES = $(TESS_SRC:%=tess/%.c)
TESS_OBJ_FILES = $(TESS_SRC:%=tess/%.$(OBJ))
TESS_HEADER_FILES = $(TESS_HEADER:%=tess/%.h) tess/wtess.h

# libigl only supports 64bits systems
ifeq (x"${WORDSIZE}",x"64")
    DRV = wings_pick_nif wings_tess
else
    $(info 32bits build ignoring libigl not supported)
    DRV = wings_pick_nif wings_tess
endif

TARGET_FILES=$(DRV:%=$(LIBDIR)/%.$(SO_EXT))

opt debug common: $(TARGET_FILES)

$(LIBDIR)/libigl.$(SO_EXT): libigl.cpp
	install -d $(LIBDIR)
	$(GCC) $(CXXFLAGS) $(IGL_OPTS) -I$(ERL_INC) $(IGL_INCLUDE) $(DEBUG) $(OUT)$@ $< $(LIBS) $(CXX_LD)

$(LIBDIR)/wings_tess.$(SO_EXT): $(TESS_OBJ_FILES) wings_tess.c
	install -d $(LIBDIR)
	$(GCC) $(CFLAGS) -I$(ERL_INC) $(DEBUG) $(OUT)$@ wings_tess.c $(TESS_OBJ_FILES) $(LIBS)

$(LIBDIR)/%.$(SO_EXT): %.c
	install -d $(LIBDIR)
	$(GCC) $(CFLAGS) -I$(ERL_INC) $(DEBUG) $(OUT) $@ $< $(LIBS)

tess/%.$(OBJ): tess/%.c $(TESS_HEADER_FILES)
	$(GCC) $(CFLAGS) -c $(OUT_OBJ)$@ $<

clean:
	rm -f $(TARGET_FILES) vc*.pdb *.$(OBJ)
	rm -f tess/*.$(OBJ)
	rm -f core