aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/buildsys/lnx/gnumake-gcc-flext.inc
blob: 33af6a1c4a95e0d12ec3f2431902053c168a9e75 (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
# build class specific settings

CMPNAME=$(OUTNAME).$(EXT).$(FLEXTMAJOR).$(FLEXTMINOR)
VERNAME=$(CMPNAME).$(FLEXTMICRO)
TARGET=$(TARGETPATH)/$(VERNAME)
INSTTARGET=$(TARGET)

ifdef SHARED
LDFLAGS += -Wl,-soname,$(CMPNAME) 
endif

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

# default target
_build_: $(TARGET)

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

$(TARGETPATH):
	-mkdir -p $@

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

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

$(TARGET) :: $(TARGETPATH) 

$(TARGET) :: $(COBJS) $(CPPOBJS)
ifdef SHARED
	$(CXX) $(LDFLAGS) $(LIBPATH) -o $@ $(COBJS) $(CPPOBJS) $(LIBS)
	chmod 755 $@
ifndef DEBUG
ifndef PROFILE
	strip --strip-unneeded $@
endif
endif
else
	$(AR) rc $@ $(COBJS) $(CPPOBJS)
endif

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

_clean_:
	-rm -r $(TARGETPATH)

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

$(FLEXTINC) $(FLEXTLIB) $(FLEXTSYS) $(FLEXTBIN):
	-mkdir -p $@

_install_: $(FLEXTINC) $(FLEXTLIB) $(FLEXTSYS) $(FLEXTBIN)
	install $(TARGET) $(FLEXTLIB)
ifdef SHARED
	/sbin/ldconfig -l $(FLEXTLIB)/$(VERNAME)
	-ln -sf $(CMPNAME) $(FLEXTLIB)/$(OUTNAME).$(EXT)
else
	-ln -sf $(VERNAME) $(FLEXTLIB)/$(TARGETNAME)
endif
	install $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(FLEXTINC)
# transfer build system
	cp -rf buildsys $(FLEXTSYS)
	install build.sh $(FLEXTSYS)
	chmod -R a+rx $(FLEXTSYS)
# make convenience script
	echo bash $(FLEXTSYS)/build.sh $$\* > $(FLEXTBIN)/flext-build.sh
	chmod a+rx $(FLEXTBIN)/flext-build.sh