From: John Melton Date: Sun, 17 Jun 2018 13:55:48 +0000 (+0100) Subject: Change Makefile to Makefile.mac and restored original Makefile X-Git-Url: https://git.rkrishnan.org/listings/...?a=commitdiff_plain;h=89ae9970051ba203a9cf6160de5405230ff0d69a;p=pihpsdr.git Change Makefile to Makefile.mac and restored original Makefile --- diff --git a/Makefile b/Makefile index 0b89ea6..cc96230 100644 --- a/Makefile +++ b/Makefile @@ -3,15 +3,6 @@ GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai" --name-only)) GIT_VERSION := $(shell git describe --abbrev=0 --tags) -#DL1YCF: this uses PortAudio rather than ALSA -PORTAUDIO_INCLUDE=PORTAUDIO - -#DL1YCF: un-commment this line for activate work-around some RedPitaty HPSDR bugs -STEMLAB_FIX_OPTION=-DSTEMLAB_FIX - -#DL1YCF: un-commment if you need librt (probably always, except on MacOS) -#LIBRT= -lrt - # uncomment the line below to include GPIO #GPIO_INCLUDE=GPIO @@ -36,31 +27,18 @@ STEMLAB_FIX_OPTION=-DSTEMLAB_FIX # uncomment the line to below include support local CW keyer #LOCALCW_INCLUDE=LOCALCW -# uncomment the line below to include support for STEMlab discovery (does not work on MacOS) +# uncomment the line below to include support for STEMlab discovery #STEMLAB_DISCOVERY=STEMLAB_DISCOVERY -# uncomment the line below to include support for stripped-down STEMlab discovery that works on MacOS -STEMLAB_DISCOVERY=STEMLAB_DISCOVERY_MAC - #uncomment the line below for the platform being compiled on -UNAME_N=MacOS -#UNAME_N=raspberrypi +UNAME_N=raspberrypi #UNAME_N=odroid #UNAME_N=up #UNAME_N=pine64 #UNAME_N=jetsen CC=gcc - -ifeq ($(UNAME_N),MacOS) -# -# This is only necessary for "make app", since the "patched" -# library names are longer -# -LINK=gcc -headerpad_max_install_names -else LINK=gcc -endif # uncomment the line below for various debug facilities #DEBUG_OPTION=-D DEBUG @@ -102,9 +80,8 @@ endif # uncomment the line below for LimeSDR (uncomment line below) #LIMESDR_INCLUDE=LIMESDR -# uncomment the line below when Radioberry radio cape is plugged in -#RADIOBERRY_INCLUDE=RADIOBERRY - +# uncomment the line below when Radioberry radio cape is plugged in (for now use emulator and old protocol) +RADIOBERRY_INCLUDE=RADIOBERRY ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY) RADIOBERRY_OPTIONS=-D RADIOBERRY endif @@ -186,17 +163,6 @@ ifeq ($(I2C_INCLUDE),I2C) I2C_OBJS=i2c.o endif -# -# STEMLAB_DISCOVERY_MAC depends on curl but not on avahi -# -ifeq ($(STEMLAB_DISCOVERY), STEMLAB_DISCOVERY_MAC) -STEMLAB_OPTIONS=-D STEMLAB_DISCOVERY `pkg-config --cflags libcurl` -STEMLAB_LIBS=`pkg-config --libs libcurl` -STEMLAB_SOURCES=stemlab_discovery.c -STEMLAB_HEADERS=stemlab_discovery.h -STEMLAB_OBJS=stemlab_discovery.o -endif - ifeq ($(STEMLAB_DISCOVERY), STEMLAB_DISCOVERY) STEMLAB_OPTIONS=-D STEMLAB_DISCOVERY \ `pkg-config --cflags avahi-gobject` \ @@ -210,23 +176,12 @@ endif GTKINCLUDES=`pkg-config --cflags gtk+-3.0` GTKLIBS=`pkg-config --libs gtk+-3.0` -ifeq ($(PORTAUDIO_INCLUDE), PORTAUDIO) -PORTAUDIO_OPTIONS=-DPORTAUDIO -AUDIO_LIBS=-lportaudio -else AUDIO_LIBS=-lasound #AUDIO_LIBS=-lsoundio -endif - -OPTIONS=-g -Wno-deprecated-declarations $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(RADIOBERRY_OPTIONS) \ - $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) \ - $(LOCALCW_OPTIONS) $(PSK_OPTIONS) $(STEMLAB_OPTIONS) $(STEMLAB_FIX_OPTION) \ - $(PORTAUDIO_OPTIONS) \ - -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3 -LIBS= $(LIBRT) -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) \ - $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) +OPTIONS=-g -Wno-deprecated-declarations $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) $(LOCALCW_OPTIONS) $(RADIOBERRY_OPTIONS) $(PSK_OPTIONS) $(STEMLAB_OPTIONS) -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3 +LIBS=-lrt -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) INCLUDES=$(GTKINCLUDES) COMPILE=$(CC) $(OPTIONS) $(INCLUDES) @@ -257,7 +212,6 @@ dsp_menu.c \ pa_menu.c \ cw_menu.c \ oc_menu.c \ -portaudio.c \ xvtr_menu.c \ equalizer_menu.c \ step_menu.c \ @@ -443,11 +397,10 @@ store_menu.o \ memory.o \ led.o \ ext.o \ -error_handler.o \ -portaudio.o +error_handler.o $(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) - $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) $(LIBS) + $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(LIBS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) all: prebuild $(PROGRAM) $(HEADERS) $(REMOTE_HEADERS) $(USBOZY_HEADERS) $(LIMESDR_HEADERS) $(FREEDV_HEADERS) $(LOCALCW_HEADERS) $(I2C_HEADERS) $(GPIO_HEADERS) $(PSK_HEADERS) $(PURESIGNAL_HEADERS) $(STEMLAB_HEADERS) $(SOURCES) $(REMOTE_SOURCES) $(USBOZY_SOURCES) $(LIMESDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) $(PSK_SOURCES) $(PURESIGNAL_SOURCES) $(STEMLAB_SOURCES) @@ -457,7 +410,6 @@ prebuild: clean: -rm -f *.o -rm -f $(PROGRAM) - -rm -rf $(PROGRAM).app install: $(PROGRAM) cp $(PROGRAM) /usr/local/bin @@ -467,45 +419,3 @@ release: $(PROGRAM) cd release; tar cvf pihpsdr.tar pihpsdr cd release; tar cvf pihpsdr-$(GIT_VERSION).tar pihpsdr -############################################################################# -# -# This is for MacOS "app" creation ONLY -# -# Note: Note that we need a wrapper script to start the program, and -# that it requires a working GTK installation on the Mac. -# The program will not work if the -# libgtk, libgdk, libglib, libgobj, libgio libraries -# are copied to the Frameworks dir and "activated", because -# this stuff depends on tons of other files in /usr/local. -# -# We bundle the "app" with the other libraries such as WDSP, -# portaudio, fftw etc. such that the "app" runs on Macs which -# do not have them. But it is *very* hard to do this with GTK. -# -# ATTENTION -# ========= -# Upon starting a freshly built application in an "app" bundle, -# it will do the FFT calculations required for wdspWisdom, since -# this is then stored *within* the app bundle. -# -############################################################################# -app: pihpsdr - @rm -rf pihpsdr.app - @mkdir -p pihpsdr.app/Contents/MacOS - @mkdir -p pihpsdr.app/Contents/Frameworks - @mkdir -p pihpsdr.app/Contents/Resources - @cp pihpsdr pihpsdr.app/Contents/MacOS/pihpsdr-bin - @cp MacOS/PkgInfo pihpsdr.app/Contents - @cp MacOS/Info.plist pihpsdr.app/Contents - @cp MacOS/hpsdr.icns pihpsdr.app/Contents/Resources/hpsdr.icns - @cp MacOS/pihpsdr.sh pihpsdr.app/Contents/MacOS/pihpsdr - @cp MacOS/hpsdr.png pihpsdr.app/Contents/Resources - @for lib in `otool -L pihpsdr.app/Contents/MacOS/pihpsdr-bin | grep dylib | sed -e "s/ (.*//" | grep -Ev "/(usr/lib|System)" | grep -Ev /libg `; do \ - libfn="`basename $$lib`"; \ - cp "$$lib" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ - chmod u+w "pihpsdr.app/Contents/Frameworks/$$libfn"; \ - install_name_tool -id "@executable_path/../Frameworks/$libfn" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ - install_name_tool -change "$$lib" "@executable_path/../Frameworks/$$libfn" pihpsdr.app/Contents/MacOS/pihpsdr-bin; \ - done -############################################################################# - diff --git a/Makefile.mac b/Makefile.mac new file mode 100644 index 0000000..0b89ea6 --- /dev/null +++ b/Makefile.mac @@ -0,0 +1,511 @@ +# Get git commit version and date +#GIT_VERSION := $(shell git --no-pager describe --tags --always --dirty) +GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai" --name-only)) +GIT_VERSION := $(shell git describe --abbrev=0 --tags) + +#DL1YCF: this uses PortAudio rather than ALSA +PORTAUDIO_INCLUDE=PORTAUDIO + +#DL1YCF: un-commment this line for activate work-around some RedPitaty HPSDR bugs +STEMLAB_FIX_OPTION=-DSTEMLAB_FIX + +#DL1YCF: un-commment if you need librt (probably always, except on MacOS) +#LIBRT= -lrt + +# uncomment the line below to include GPIO +#GPIO_INCLUDE=GPIO + +# uncomment the line below to include MCP23017 I2C +#I2C_INCLUDE=I2C + +# uncomment the line below to include USB Ozy support +# USBOZY_INCLUDE=USBOZY + +# uncomment the line below to include support for psk31 +#PSK_INCLUDE=PSK + +# uncomment the line to below include support for FreeDV codec2 +#FREEDV_INCLUDE=FREEDV + +# uncomment the line below to include Pure Signal support +#PURESIGNAL_INCLUDE=PURESIGNAL + +# uncomment the line to below include support for sx1509 i2c expander +#SX1509_INCLUDE=sx1509 + +# uncomment the line to below include support local CW keyer +#LOCALCW_INCLUDE=LOCALCW + +# uncomment the line below to include support for STEMlab discovery (does not work on MacOS) +#STEMLAB_DISCOVERY=STEMLAB_DISCOVERY + +# uncomment the line below to include support for stripped-down STEMlab discovery that works on MacOS +STEMLAB_DISCOVERY=STEMLAB_DISCOVERY_MAC + +#uncomment the line below for the platform being compiled on +UNAME_N=MacOS +#UNAME_N=raspberrypi +#UNAME_N=odroid +#UNAME_N=up +#UNAME_N=pine64 +#UNAME_N=jetsen + +CC=gcc + +ifeq ($(UNAME_N),MacOS) +# +# This is only necessary for "make app", since the "patched" +# library names are longer +# +LINK=gcc -headerpad_max_install_names +else +LINK=gcc +endif + +# uncomment the line below for various debug facilities +#DEBUG_OPTION=-D DEBUG + +ifeq ($(PURESIGNAL_INCLUDE),PURESIGNAL) +PURESIGNAL_OPTIONS=-D PURESIGNAL +PURESIGNAL_SOURCES= \ +ps_menu.c +PURESIGNAL_HEADERS= \ +ps_menu.h +PURESIGNAL_OBJS= \ +ps_menu.o +endif + +ifeq ($(REMOTE_INCLUDE),REMOTE) +REMOTE_OPTIONS=-D REMOTE +REMOTE_SOURCES= \ +remote_radio.c \ +remote_receiver.c +REMOTE_HEADERS= \ +remote_radio.h \ +remote_receiver.h +REMOTE_OBJS= \ +remote_radio.o \ +remote_receiver.o +endif + +ifeq ($(USBOZY_INCLUDE),USBOZY) +USBOZY_OPTIONS=-D USBOZY +USBOZY_LIBS=-lusb-1.0 +USBOZY_SOURCES= \ +ozyio.c +USBOZY_HEADERS= \ +ozyio.h +USBOZY_OBJS= \ +ozyio.o +endif + +# uncomment the line below for LimeSDR (uncomment line below) +#LIMESDR_INCLUDE=LIMESDR + +# uncomment the line below when Radioberry radio cape is plugged in +#RADIOBERRY_INCLUDE=RADIOBERRY + +ifeq ($(RADIOBERRY_INCLUDE),RADIOBERRY) +RADIOBERRY_OPTIONS=-D RADIOBERRY +endif + +ifeq ($(LIMESDR_INCLUDE),LIMESDR) +LIMESDR_OPTIONS=-D LIMESDR +SOAPYSDRLIBS=-lSoapySDR +LIMESDR_SOURCES= \ +lime_discovery.c \ +lime_protocol.c +LIMESDR_HEADERS= \ +lime_discovery.h \ +lime_protocol.h +LIMESDR_OBJS= \ +lime_discovery.o \ +lime_protocol.o +endif + + +ifeq ($(PSK_INCLUDE),PSK) +PSK_OPTIONS=-D PSK +PSKLIBS=-lpsk +PSK_SOURCES= \ +psk.c \ +psk_waterfall.c +PSK_HEADERS= \ +psk.h \ +psk_waterfall.h +PSK_OBJS= \ +psk.o \ +psk_waterfall.o +endif + + +ifeq ($(FREEDV_INCLUDE),FREEDV) +FREEDV_OPTIONS=-D FREEDV +FREEDVLIBS=-lcodec2 +FREEDV_SOURCES= \ +freedv.c \ +freedv_menu.c +FREEDV_HEADERS= \ +freedv.h \ +freedv_menu.h +FREEDV_OBJS= \ +freedv.o \ +freedv_menu.o +endif + +ifeq ($(LOCALCW_INCLUDE),LOCALCW) +LOCALCW_OPTIONS=-D LOCALCW +LOCALCW_SOURCES= \ +beep.c \ +iambic.c +LOCALCW_HEADERS= \ +beep.h \ +iambic.h +LOCALCW_OBJS= \ +iambic.o +endif + +ifeq ($(GPIO_INCLUDE),GPIO) + GPIO_OPTIONS=-D GPIO + GPIO_LIBS=-lwiringPi -lpigpio + GPIO_SOURCES= \ + gpio.c \ + encoder_menu.c + GPIO_HEADERS= \ + gpio.h \ + encoder_menu.h + GPIO_OBJS= \ + gpio.o \ + encoder_menu.o +endif + +ifeq ($(I2C_INCLUDE),I2C) + I2C_OPTIONS=-D I2C + I2C_SOURCES=i2c.c + I2C_HEADERS=i2c.h + I2C_OBJS=i2c.o +endif + +# +# STEMLAB_DISCOVERY_MAC depends on curl but not on avahi +# +ifeq ($(STEMLAB_DISCOVERY), STEMLAB_DISCOVERY_MAC) +STEMLAB_OPTIONS=-D STEMLAB_DISCOVERY `pkg-config --cflags libcurl` +STEMLAB_LIBS=`pkg-config --libs libcurl` +STEMLAB_SOURCES=stemlab_discovery.c +STEMLAB_HEADERS=stemlab_discovery.h +STEMLAB_OBJS=stemlab_discovery.o +endif + +ifeq ($(STEMLAB_DISCOVERY), STEMLAB_DISCOVERY) +STEMLAB_OPTIONS=-D STEMLAB_DISCOVERY \ + `pkg-config --cflags avahi-gobject` \ + `pkg-config --cflags libcurl` +STEMLAB_LIBS=`pkg-config --libs avahi-gobject` `pkg-config --libs libcurl` +STEMLAB_SOURCES=stemlab_discovery.c +STEMLAB_HEADERS=stemlab_discovery.h +STEMLAB_OBJS=stemlab_discovery.o +endif + +GTKINCLUDES=`pkg-config --cflags gtk+-3.0` +GTKLIBS=`pkg-config --libs gtk+-3.0` + +ifeq ($(PORTAUDIO_INCLUDE), PORTAUDIO) +PORTAUDIO_OPTIONS=-DPORTAUDIO +AUDIO_LIBS=-lportaudio +else +AUDIO_LIBS=-lasound +#AUDIO_LIBS=-lsoundio +endif + +OPTIONS=-g -Wno-deprecated-declarations $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(RADIOBERRY_OPTIONS) \ + $(USBOZY_OPTIONS) $(I2C_OPTIONS) $(GPIO_OPTIONS) $(LIMESDR_OPTIONS) $(FREEDV_OPTIONS) \ + $(LOCALCW_OPTIONS) $(PSK_OPTIONS) $(STEMLAB_OPTIONS) $(STEMLAB_FIX_OPTION) \ + $(PORTAUDIO_OPTIONS) \ + -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION) -O3 + +LIBS= $(LIBRT) -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(PSKLIBS) $(GTKLIBS) $(GPIO_LIBS) \ + $(SOAPYSDRLIBS) $(FREEDVLIBS) $(STEMLAB_LIBS) + +INCLUDES=$(GTKINCLUDES) + +COMPILE=$(CC) $(OPTIONS) $(INCLUDES) + +.c.o: + $(COMPILE) -c -o $@ $< + +PROGRAM=pihpsdr + +SOURCES= \ +audio.c \ +audio_waterfall.c \ +band.c \ +configure.c \ +frequency.c \ +discovered.c \ +discovery.c \ +filter.c \ +main.c \ +new_menu.c \ +about_menu.c \ +exit_menu.c \ +radio_menu.c \ +rx_menu.c \ +ant_menu.c \ +display_menu.c \ +dsp_menu.c \ +pa_menu.c \ +cw_menu.c \ +oc_menu.c \ +portaudio.c \ +xvtr_menu.c \ +equalizer_menu.c \ +step_menu.c \ +meter_menu.c \ +band_menu.c \ +bandstack_menu.c \ +mode_menu.c \ +filter_menu.c \ +noise_menu.c \ +agc_menu.c \ +vox_menu.c \ +fft_menu.c \ +diversity_menu.c \ +freqent_menu.c \ +tx_menu.c \ +vfo_menu.c \ +test_menu.c \ +meter.c \ +mode.c \ +old_discovery.c \ +new_discovery.c \ +old_protocol.c \ +new_protocol.c \ +new_protocol_programmer.c \ +rx_panadapter.c \ +tx_panadapter.c \ +property.c \ +radio.c \ +receiver.c \ +rigctl.c \ +rigctl_menu.c \ +toolbar.c \ +transmitter.c \ +sliders.c \ +version.c \ +vfo.c \ +waterfall.c \ +button_text.c \ +vox.c \ +update.c \ +store.c \ +store_menu.c \ +memory.c \ +led.c \ +ext.c \ +error_handler.c + + +HEADERS= \ +audio.h \ +audio_waterfall.h \ +agc.h \ +alex.h \ +band.h \ +configure.h \ +frequency.h \ +bandstack.h \ +channel.h \ +discovered.h \ +discovery.h \ +filter.h \ +new_menu.h \ +about_menu.h \ +rx_menu.h \ +exit_menu.h \ +radio_menu.h \ +ant_menu.h \ +display_menu.h \ +dsp_menu.h \ +pa_menu.h \ +cw_menu.h \ +oc_menu.h \ +xvtr_menu.h \ +equalizer_menu.h \ +step_menu.h \ +meter_menu.h \ +band_menu.h \ +bandstack_menu.h \ +mode_menu.h \ +filter_menu.h \ +noise_menu.h \ +agc_menu.h \ +vox_menu.h \ +fft_menu.h \ +diversity_menu.h \ +freqent_menu.h \ +tx_menu.h \ +vfo_menu.h \ +test_menu.h \ +meter.h \ +mode.h \ +old_discovery.h \ +new_discovery.h \ +old_protocol.h \ +new_protocol.h \ +rx_panadapter.h \ +tx_panadapter.h \ +property.h \ +radio.h \ +receiver.h \ +rigctl.h \ +rigctl_menu.h \ +toolbar.h \ +transmitter.h \ +sliders.h \ +version.h \ +vfo.h \ +waterfall.h \ +button_text.h \ +vox.h \ +update.h \ +store.h \ +store_menu.h \ +memory.h \ +led.h \ +ext.h \ +error_handler.h + + +OBJS= \ +audio.o \ +audio_waterfall.o \ +band.o \ +configure.o \ +frequency.o \ +discovered.o \ +discovery.o \ +filter.o \ +version.o \ +main.o \ +new_menu.o \ +about_menu.o \ +rx_menu.o \ +exit_menu.o \ +radio_menu.o \ +ant_menu.o \ +display_menu.o \ +dsp_menu.o \ +pa_menu.o \ +cw_menu.o \ +oc_menu.o \ +xvtr_menu.o \ +equalizer_menu.o \ +step_menu.o \ +meter_menu.o \ +band_menu.o \ +bandstack_menu.o \ +mode_menu.o \ +filter_menu.o \ +noise_menu.o \ +agc_menu.o \ +vox_menu.o \ +fft_menu.o \ +diversity_menu.o \ +freqent_menu.o \ +tx_menu.o \ +vfo_menu.o \ +test_menu.o \ +meter.o \ +mode.o \ +old_discovery.o \ +new_discovery.o \ +old_protocol.o \ +new_protocol.o \ +new_protocol_programmer.o \ +rx_panadapter.o \ +tx_panadapter.o \ +property.o \ +radio.o \ +receiver.o \ +rigctl.o \ +rigctl_menu.o \ +toolbar.o \ +transmitter.o \ +sliders.o \ +vfo.o \ +waterfall.o \ +button_text.o \ +vox.o \ +update.o \ +store.o \ +store_menu.o \ +memory.o \ +led.o \ +ext.o \ +error_handler.o \ +portaudio.o + +$(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) + $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(I2C_OBJS) $(GPIO_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) $(LOCALCW_OBJS) $(PSK_OBJS) $(PURESIGNAL_OBJS) $(STEMLAB_OBJS) $(LIBS) + +all: prebuild $(PROGRAM) $(HEADERS) $(REMOTE_HEADERS) $(USBOZY_HEADERS) $(LIMESDR_HEADERS) $(FREEDV_HEADERS) $(LOCALCW_HEADERS) $(I2C_HEADERS) $(GPIO_HEADERS) $(PSK_HEADERS) $(PURESIGNAL_HEADERS) $(STEMLAB_HEADERS) $(SOURCES) $(REMOTE_SOURCES) $(USBOZY_SOURCES) $(LIMESDR_SOURCES) $(FREEDV_SOURCES) $(I2C_SOURCES) $(GPIO_SOURCES) $(PSK_SOURCES) $(PURESIGNAL_SOURCES) $(STEMLAB_SOURCES) + +prebuild: + rm -f version.o + +clean: + -rm -f *.o + -rm -f $(PROGRAM) + -rm -rf $(PROGRAM).app + +install: $(PROGRAM) + cp $(PROGRAM) /usr/local/bin + +release: $(PROGRAM) + cp $(PROGRAM) release/pihpsdr + cd release; tar cvf pihpsdr.tar pihpsdr + cd release; tar cvf pihpsdr-$(GIT_VERSION).tar pihpsdr + +############################################################################# +# +# This is for MacOS "app" creation ONLY +# +# Note: Note that we need a wrapper script to start the program, and +# that it requires a working GTK installation on the Mac. +# The program will not work if the +# libgtk, libgdk, libglib, libgobj, libgio libraries +# are copied to the Frameworks dir and "activated", because +# this stuff depends on tons of other files in /usr/local. +# +# We bundle the "app" with the other libraries such as WDSP, +# portaudio, fftw etc. such that the "app" runs on Macs which +# do not have them. But it is *very* hard to do this with GTK. +# +# ATTENTION +# ========= +# Upon starting a freshly built application in an "app" bundle, +# it will do the FFT calculations required for wdspWisdom, since +# this is then stored *within* the app bundle. +# +############################################################################# +app: pihpsdr + @rm -rf pihpsdr.app + @mkdir -p pihpsdr.app/Contents/MacOS + @mkdir -p pihpsdr.app/Contents/Frameworks + @mkdir -p pihpsdr.app/Contents/Resources + @cp pihpsdr pihpsdr.app/Contents/MacOS/pihpsdr-bin + @cp MacOS/PkgInfo pihpsdr.app/Contents + @cp MacOS/Info.plist pihpsdr.app/Contents + @cp MacOS/hpsdr.icns pihpsdr.app/Contents/Resources/hpsdr.icns + @cp MacOS/pihpsdr.sh pihpsdr.app/Contents/MacOS/pihpsdr + @cp MacOS/hpsdr.png pihpsdr.app/Contents/Resources + @for lib in `otool -L pihpsdr.app/Contents/MacOS/pihpsdr-bin | grep dylib | sed -e "s/ (.*//" | grep -Ev "/(usr/lib|System)" | grep -Ev /libg `; do \ + libfn="`basename $$lib`"; \ + cp "$$lib" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ + chmod u+w "pihpsdr.app/Contents/Frameworks/$$libfn"; \ + install_name_tool -id "@executable_path/../Frameworks/$libfn" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ + install_name_tool -change "$$lib" "@executable_path/../Frameworks/$$libfn" pihpsdr.app/Contents/MacOS/pihpsdr-bin; \ + done +############################################################################# +