cnping

Minimal Graphical Ping Tool
git clone https://git.sinitax.com/cnlohr/cnping
Log | Files | Refs | Submodules | README | LICENSE | sfeed.txt

Makefile (3108B)


      1CFLAGS ?= -s -Os -I/opt/X11/include -Wall
      2LDFLAGS ?= -s -L/opt/X11/lib/
      3CC? = gcc
      4
      5ICONSPATH = freedesktop/icons/hicolor/
      6APPNAME = com.github.cntools.cnping
      7
      8all : cnping
      9
     10#CFLAGS := $(CFLAGS) -DCNFGOGL
     11#LDFLAGS := $(LDFLAGS) -lGL
     12
     13clean :
     14	rm -rf *.o *~ cnping cnping.exe cnping_mac searchnet
     15	rm -rf rawdraw/*.o
     16
     17
     18# Windows
     19
     20#MINGW32 := /usr/bin/i686-w64-mingw32-
     21MINGW32 ?= i686-w64-mingw32-
     22
     23# If you don't need admin privileges
     24ADMINFLAGS := $(ADMINFLAGS) -DWIN_USE_NO_ADMIN_PING
     25
     26# Add git version to CFLAGS
     27GIT_VERSION := "$(shell git describe --abbrev=4 --dirty --always --tags)"
     28CFLAGS += -DVERSION=\"$(GIT_VERSION)\"
     29
     30cnping-wingdi.exe : cnping.c ping.c httping.c resources.o
     31	$(MINGW32)gcc -g -fno-ident -mwindows -m32 $(CFLAGS) -o $@ $^  -lgdi32 -lws2_32 -s -D_WIN32_WINNT=0x0600 -DWIN32 -liphlpapi -DMINGW_BUILD $(ADMINFLAGS)
     32
     33cnping.exe : cnping.c ping.c httping.c resolve.c resources.o
     34	$(MINGW32)gcc -g -fno-ident -mwindows -m32 -DCNFGOGL $(CFLAGS) -o $@ $^  -lgdi32 -lws2_32 -s -D_WIN32_WINNT=0x0600 -DWIN32 -liphlpapi -lopengl32 -DMINGW_BUILD $(ADMINFLAGS)
     35
     36resources.o : resources.rc
     37	$(MINGW32)windres resources.rc -o resources.o $(ADMINFLAGS)
     38
     39
     40# Unix
     41
     42cnping : cnping.c ping.c httping.c resolve.c
     43	$(CC) $(CFLAGS) -o $@ $^ -lX11 -lm -lpthread -lGL $(LDFLAGS)
     44
     45cnping_ogl : cnping.c ping.c httping.c resolve.c
     46	$(CC) $(CFLAGS) -o $@ $^ -DCNFGOGL $(CFLAGS) -lX11 -lm -lpthread $(LDFLAGS) -lGL
     47
     48cnping_mac : cnping.c ping.c httping.c resolve.c
     49	$(CC) -o cnping $^ -x objective-c -framework Cocoa -framework QuartzCore -lm -lpthread -DOSX
     50
     51searchnet : ping.c searchnet.c resolve.c
     52	$(CC) $(CFLAGS) -o $@ $^ -lpthread
     53
     54linuxinstall : cnping
     55	rm -f /usr/local/bin/cnping
     56	cp cnping /usr/local/bin/
     57	cp -r $(ICONSPATH) /usr/local/share/icons
     58	cp freedesktop/${APPNAME}.desktop /usr/local/share/applications
     59	cp freedesktop/${APPNAME}.metainfo.xml /usr/local/share/metainfo
     60	setcap cap_net_raw+ep /usr/local/bin/cnping
     61#	sudo chmod +t /usr/local/bin/cnping  #One option - set the stuid bit.
     62#	sudo install cnping /usr/local/bin/  #Another option - using install.
     63
     64# minimal linux install, may be useful for development
     65minlinuxinstall : cnping
     66	sudo rm -f /usr/local/bin/cnping
     67	sudo cp cnping /usr/local/bin/
     68	sudo setcap cap_net_raw+ep /usr/local/bin/cnping
     69
     70
     71
     72# this target requires imagemagick
     73updateicons : ${ICONSPATH}scalable/apps/${APPNAME}.svg
     74	convert $^ -resize 16x16 ${ICONSPATH}16x16/apps/${APPNAME}.png
     75	convert $^ -resize 32x32 ${ICONSPATH}32x32/apps/${APPNAME}.png
     76	convert $^ -resize 48x48 ${ICONSPATH}48x48/apps/${APPNAME}.png
     77	convert $^ -resize 256x256 ${ICONSPATH}256x256/apps/${APPNAME}.png
     78	convert $^ -resize 1024x1024 ${ICONSPATH}1024x1024/apps/${APPNAME}.png
     79
     80# after creating the ico file use GIMP to compress it:
     81# Image-> Mode -> Indexed...
     82# Choose "Generate optimum palette"
     83# Maximum number of colors: 3 (may change if the icon changes)
     84# "Convert"
     85# File -> Export As
     86# Check "Compressed (PNG)" in every resolution
     87# "Export"
     88cnping.ico: ${ICONSPATH}scalable/apps/${APPNAME}.svg
     89	convert $^ -density 300 -define icon:auto-resize=256,64,16 -background none $@
     90