aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/build/win/make-mingw.inc
blob: 3c4e4b1dd36210b11b649fbfd5dfcad2f1c706f8 (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 += -shared -Wl,-x 

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 $(subst /,\,$@)

$(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)

$(INSTPATH):
	-mkdir $(subst /,\,$@)

install:: $(INSTPATH)

install:: $(TARGET)
	copy $(subst /,\,$^ $(INSTPATH))

.PHONY: clean
clean:
	-del $(subst /,\,$(COBJS) $(CPPOBJS) $(TARGET))