Improve Linux build

Introduces several improvements to Makefiles:
* BUILD=[debug|release] flag with CFLAGS consistent with vcproj
* DESTDIR for staged builds
* installation paths can be overridden in make arguments
* `make install` makes sure install dirs are present
* debug build adds GDB debug symbols
pull/11/head
Adam Kolakowski 6 years ago
parent cbfc82c50c
commit 52537aca8f

@ -7,7 +7,8 @@ OBJECTS = AMBEFEC.o AnnouncementUnit.o ArduinoController.o BeaconUnit.o Callsign
SlowDataDecoder.o SlowDataEncoder.o SoundCardController.o SoundCardReaderWriter.o SplitController.o TCPReaderWriter.o \
Timer.o UDPReaderWriter.o UDRCController.o URIUSBController.o Utils.o
.PHONY: all
.PHONY: all clean
all: Common.a
Common.a: $(OBJECTS)
@ -19,7 +20,6 @@ Common.a: $(OBJECTS)
$(CXX) -DwxUSE_GUI=0 $(CFLAGS) -c -o $@ $<
$(CXX) -MM -DwxUSE_GUI=0 $(CFLAGS) $< > $*.d
.PHONY: clean
clean:
$(RM) Common.a *.o *.d *.bak *~

@ -1,7 +1,8 @@
OBJECTS = DStarRepeaterApp.o DStarRepeaterLogRedirect.o DStarRepeaterRXThread.o DStarRepeaterStatusData.o \
DStarRepeaterThread.o DStarRepeaterTRXThread.o DStarRepeaterTXRXThread.o DStarRepeaterTXThread.o
.PHONY: all
.PHONY: all install clean
all: dstarrepeaterd
dstarrepeaterd: $(OBJECTS) ../Common/Common.a
@ -13,9 +14,8 @@ dstarrepeaterd: $(OBJECTS) ../Common/Common.a
$(CXX) -DwxUSE_GUI=0 $(CFLAGS) -I../Common -c -o $@ $<
$(CXX) -MM -DwxUSE_GUI=0 $(CFLAGS) -I../Common $< > $*.d
.PHONY: install
install:
install -g bin -o root -m 0775 dstarrepeaterd $(BINDIR)
install -g root -o root -m 0755 dstarrepeaterd $(DESTDIR)$(BINDIR)
clean:
$(RM) dstarrepeaterd *.o *.d *.bak *~

@ -1,6 +1,8 @@
OBJECTS = DStarRepeaterApp.o DStarRepeaterFrame.o DStarRepeaterLogRedirect.o DStarRepeaterRXThread.o DStarRepeaterStatusData.o \
DStarRepeaterThread.o DStarRepeaterTRXThread.o DStarRepeaterTXRXThread.o DStarRepeaterTXThread.o
.PHONY: install clean
all: dstarrepeater
dstarrepeater: $(OBJECTS) ../Common/Common.a ../GUICommon/GUICommon.a
@ -10,11 +12,9 @@ dstarrepeater: $(OBJECTS) ../Common/Common.a ../GUICommon/GUICommon.a
$(CXX) $(CFLAGS) -I../Common -I../GUICommon -c -o $@ $<
$(CXX) -MM $(CFLAGS) -I../Common -I../GUICommon $< > $*.d
.PHONY: install
install:
install -g bin -o root -m 0775 dstarrepeater $(BINDIR)
install -g root -o root -m 0755 dstarrepeater $(DESTDIR)$(BINDIR)
.PHONY: clean
clean:
$(RM) dstarrepeater *.o *.d *.bak *~

@ -5,7 +5,7 @@ OBJECTS = DStarRepeaterConfigActiveHangSet.o DStarRepeaterConfigAnnouncementSet.
DStarRepeaterConfigIcomSet.o DStarRepeaterConfigMMDVMSet.o DStarRepeaterConfigModemSet.o DStarRepeaterConfigNetworkSet.o \
DStarRepeaterConfigSoundCardSet.o DStarRepeaterConfigSplitSet.o DStarRepeaterConfigTimesSet.o
.PHONY: all
.PHONY: all install clean
all: dstarrepeaterconfig
dstarrepeaterconfig: $(OBJECTS) ../GUICommon/GUICommon.a ../Common/Common.a
@ -17,11 +17,9 @@ dstarrepeaterconfig: $(OBJECTS) ../GUICommon/GUICommon.a ../Common/Common.a
$(CXX) $(CFLAGS) -I../GUICommon -I../Common -c -o $@ $<
$(CXX) -MM $(CFLAGS) -I../GUICommon -I../Common $< > $*.d
.PHONY: install
install:
install -g bin -o root -m 0775 dstarrepeaterconfig $(BINDIR)
install -g root -o root -m 0755 dstarrepeaterconfig $(DESTDIR)$(BINDIR)
.PHONY: install
clean:
$(RM) dstarrepeaterconfig *.o *.d *.bak *~

@ -1,22 +1,24 @@
.PHONY: install
install:
install -d -g bin -o root -m 0775 $(DATADIR)
install -g bin -o root -m 0664 de_DE.ambe $(DATADIR)
install -g bin -o root -m 0664 de_DE.indx $(DATADIR)
install -g bin -o root -m 0664 dk_DK.ambe $(DATADIR)
install -g bin -o root -m 0664 dk_DK.indx $(DATADIR)
install -g bin -o root -m 0664 en_GB.ambe $(DATADIR)
install -g bin -o root -m 0664 en_GB.indx $(DATADIR)
install -g bin -o root -m 0664 en_US.ambe $(DATADIR)
install -g bin -o root -m 0664 en_US.indx $(DATADIR)
install -g bin -o root -m 0664 es_ES.ambe $(DATADIR)
install -g bin -o root -m 0664 es_ES.indx $(DATADIR)
install -g bin -o root -m 0664 fr_FR.ambe $(DATADIR)
install -g bin -o root -m 0664 fr_FR.indx $(DATADIR)
install -g bin -o root -m 0664 it_IT.ambe $(DATADIR)
install -g bin -o root -m 0664 it_IT.indx $(DATADIR)
install -g bin -o root -m 0664 no_NO.ambe $(DATADIR)
install -g bin -o root -m 0664 no_NO.indx $(DATADIR)
install -g bin -o root -m 0664 pl_PL.ambe $(DATADIR)
install -g bin -o root -m 0664 pl_PL.indx $(DATADIR)
install -g bin -o root -m 0664 se_SE.ambe $(DATADIR)
install -g bin -o root -m 0664 se_SE.indx $(DATADIR)
install -d -g root -o root -m 0755 $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 de_DE.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 de_DE.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 dk_DK.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 dk_DK.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 en_GB.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 en_GB.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 en_US.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 en_US.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 es_ES.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 es_ES.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 fr_FR.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 fr_FR.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 it_IT.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 it_IT.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 no_NO.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 no_NO.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 pl_PL.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 pl_PL.indx $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 se_SE.ambe $(DESTDIR)$(DATADIR)
install -g root -o root -m 0644 se_SE.indx $(DESTDIR)$(DATADIR)

@ -1,6 +1,6 @@
OBJECTS = AddressTextCtrl.o CallsignTextCtrl.o MessageTextCtrl.o PortTextCtrl.o RestrictedTextCtrl.o
.PHONY: all
.PHONY: all clean
all: GUICommon.a
GUICommon.a: $(OBJECTS)
@ -12,7 +12,6 @@ GUICommon.a: $(OBJECTS)
$(CXX) $(CFLAGS) -c -o $@ $<
$(CXX) -MM $(CFLAGS) $< > $*.d
.PHONY: clean
clean:
$(RM) GUICommon.a *.o *.d *.bak *~

@ -1,10 +1,19 @@
export DATADIR := "/usr/share/dstarrepeater"
export LOGDIR := "/var/log"
export CONFDIR := "/etc"
export BINDIR := "/usr/bin"
.PHONY: install installdirs clean force
export BUILD ?= debug
export DATADIR ?= /usr/share/dstarrepeater
export LOGDIR ?= /var/log
export CONFDIR ?= /etc
export BINDIR ?= /usr/bin
DEBUGFLAGS := -g -D_DEBUG
RELEASEFLAGS := -DNDEBUG -DwxDEBUG_LEVEL=0
export CXX := $(shell wx-config --cxx)
export CFLAGS := -O2 -Wall $(shell wx-config --cxxflags) -DLOG_DIR='$(LOGDIR)' -DCONF_DIR='$(CONFDIR)' -DDATA_DIR='$(DATADIR)'
export CFLAGS := -O2 -Wall $(shell wx-config --cxxflags) -DLOG_DIR='"$(LOGDIR)"' -DCONF_DIR='"$(CONFDIR)"' -DDATA_DIR='"$(DATADIR)"'
ifeq ($(BUILD), debug)
export CFLAGS := $(CFLAGS) $(DEBUGFLAGS)
else ifeq ($(BUILD), release)
export CFLAGS := $(CFLAGS) $(RELEASEFLAGS)
endif
export GUILIBS := $(shell wx-config --libs adv,core,base) -lasound
export LIBS := $(shell wx-config --libs base) -lasound -lusb-1.0
export LDFLAGS :=
@ -23,19 +32,19 @@ GUICommon/GUICommon.a: force
Common/Common.a: force
$(MAKE) -C Common
.PHONY: install
install: all
installdirs:
/bin/mkdir -p $(DESTDIR)$(DATADIR) $(DESTDIR)$(LOGDIR) $(DESTDIR)$(CONFDIR) $(DESTDIR)$(BINDIR)
install: all installdirs
$(MAKE) -C Data install
$(MAKE) -C DStarRepeater install
$(MAKE) -C DStarRepeaterConfig install
.PHONY: clean
clean:
$(MAKE) -C Common clean
$(MAKE) -C GUICommon clean
$(MAKE) -C DStarRepeater clean
$(MAKE) -C DStarRepeaterConfig clean
.PHONY: force
force:
@true

@ -1,14 +1,25 @@
export DATADIR := "/usr/share/dstarrepeater"
export LOGDIR := "/var/log"
export CONFDIR := "/etc"
export BINDIR := "/usr/bin"
export BUILD ?= debug
export DATADIR ?= /usr/share/dstarrepeater
export LOGDIR ?= /var/log
export CONFDIR ?= /etc
export BINDIR ?= /usr/bin
DEBUGFLAGS := -g -D_DEBUG
RELEASEFLAGS := -DNDEBUG -DwxDEBUG_LEVEL=0
export CXX := $(shell wx-config --cxx)
export CFLAGS := -O2 -Wall $(shell wx-config --cxxflags) -DLOG_DIR='$(LOGDIR)' -DCONF_DIR='$(CONFDIR)' -DDATA_DIR='$(DATADIR)'
export CFLAGS := -O2 -Wall $(shell wx-config --cxxflags) -DLOG_DIR='"$(LOGDIR)"' -DCONF_DIR='"$(CONFDIR)"' -DDATA_DIR='"$(DATADIR)"'
ifeq ($(BUILD), debug)
export CFLAGS := $(CFLAGS) $(DEBUGFLAGS)
else ifeq ($(BUILD), release)
export CFLAGS := $(CFLAGS) $(RELEASEFLAGS)
endif
export GUILIBS := $(shell wx-config --libs adv,core,base) -lasound -lusb-1.0
export LIBS := $(shell wx-config --libs base) -lasound -lusb-1.0
export LDFLAGS :=
.PHONY: install installdirs clean force
all: DStarRepeater/dstarrepeater DStarRepeaterConfig/dstarrepeaterconfig
DStarRepeater/dstarrepeater: GUICommon/GUICommon.a Common/Common.a force
@ -23,19 +34,19 @@ GUICommon/GUICommon.a: force
Common/Common.a: force
$(MAKE) -C Common
.PHONY: install
install: all
installdirs:
/bin/mkdir -p $(DESTDIR)$(DATADIR) $(DESTDIR)$(LOGDIR) $(DESTDIR)$(CONFDIR) $(DESTDIR)$(BINDIR)
install: all installdirs
$(MAKE) -C Data install
$(MAKE) -C DStarRepeater -f MakefileGUI install
$(MAKE) -C DStarRepeaterConfig install
.PHONY: clean
clean:
$(MAKE) -C Common clean
$(MAKE) -C GUICommon clean
$(MAKE) -C DStarRepeater -f MakefileGUI clean
$(MAKE) -C DStarRepeaterConfig clean
.PHONY: force
force:
@true

Loading…
Cancel
Save

Powered by TurnKey Linux.