aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/build/make-mac-gen-gcc.inc
blob: ffb497209b166bef67ea8a2e8f954e4e47c09455 (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
LDFLAGS += -Wl,-x -framework ApplicationServices -framework vecLib

ifdef DEBUG
CFLAGS += -g -D_DEBUG
else
CFLAGS += $(OFLAGS) -DNDEBUG
LDFLAGS += -Wl,-S
endif

##############################################

INCPATH += -I$(FLEXTPATH)
LIBPATH += -L$(FLEXTPATH)

ifdef SHARED
# --- shared ---
DEFS += -DFLEXT_SHARED

else
ifdef THREADED
# --- static multi-threaded ---
DEFS += -DFLEXT_THREADS

else 
# --- static single-threaded ---

endif
endif

##############################################

TARGET=$(OUTPATH)/$(NAME).$(EXT)

CSRCS=$(patsubst %.c,$(SRCDIR)/%.c,$(filter %.c,$(SRCS)))
CPPSRCS=$(patsubst %.cpp,$(SRCDIR)/%.cpp,$(filter %.cpp,$(SRCS)))
COBJS=$(patsubst %.c,$(OUTPATH)/%.o,$(filter %.c,$(SRCS))) 
CPPOBJS=$(patsubst %.cpp,$(OUTPATH)/%.opp,$(filter %.cpp,$(SRCS))) 

# default target
all: $(OUTPATH) $(TARGET)

$(CSRCS) $(CPPSRCS): $(patsubst %,$(SRCDIR)/%,$(HDRS))
	touch $@

$(OUTPATH):
	mkdir $(OUTPATH)

$(OUTPATH)/%.opp : $(SRCDIR)/%.cpp
	$(CXX) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@

$(OUTPATH)/%.o : $(SRCDIR)/%.c
	$(CC) -c $(CFLAGS) $(DEFS) $(INCPATH) $< -o $@

$(TARGET) : $(COBJS) $(CPPOBJS)
	$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
	chmod 755 $@

$(INSTPATH):
	mkdir $(INSTPATH)

install:: $(INSTPATH)

install:: $(TARGET)
	install $^ $(INSTPATH)

.PHONY: clean
clean:
	$(RM) $(COBJS) $(CPPOBJS) $(TARGET)