I wanted to use it on Solaris which has different way to obtain system statistics. I build a support file and changed Makefile to take the operating system into account. Then I moved to fixing the widget. The comments in the code said that it supports only 2 CPUs. I've added an aggregation so that it still shows two graphs but represents all CPUs. Lastly, I some programmatic flaws - like multiple loops for one task - cleaning up the code a bit. It should also speed up the widget a little.
		
			
				
	
	
		
			43 lines
		
	
	
	
		
			884 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
	
		
			884 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
#(c)1999-2003 redseb 
 | 
						|
# Adapted for wmSMPmon 2.9.x and higher: Thomas Ribbrock
 | 
						|
 | 
						|
# Change the following two to determine installation location
 | 
						|
BINDIR=/usr/local/bin/
 | 
						|
MANDIR=/usr/local/share/man/
 | 
						|
 | 
						|
OS := $(shell uname -s)
 | 
						|
 | 
						|
SRC = general.c ../wmgeneral/wmgeneral.c wmSMPmon.c
 | 
						|
EXE = wmSMPmon
 | 
						|
MAN = wmSMPmon.1
 | 
						|
OBJ = $(SRC:.c=.o)
 | 
						|
INSTALL = /usr/bin/install
 | 
						|
INSTALLEXEFLAGS = -m 755 -s
 | 
						|
INSTALLMANFLAGS = -m 644
 | 
						|
CC = gcc
 | 
						|
CFLAGS = -Wall -O2 -g
 | 
						|
LIB = -L/usr/X11R6/lib -lXpm -lXext -lX11
 | 
						|
 | 
						|
ifeq ($(OS),Linux)
 | 
						|
SRC += sysinfo-linux.c
 | 
						|
endif
 | 
						|
ifeq ($(OS),SunOS)
 | 
						|
SRC += sysinfo-solaris.c
 | 
						|
LIB += -lkstat
 | 
						|
endif
 | 
						|
 | 
						|
all: $(OBJ)
 | 
						|
	$(CC) -o $(EXE) $(OBJ) $(LIB)
 | 
						|
 | 
						|
$(OBJ): %.o : %.c
 | 
						|
	$(CC) $(CFLAGS) -c -o $@ $<
 | 
						|
 | 
						|
clean:
 | 
						|
	rm -rf $(EXE) 
 | 
						|
	rm -rf *.o
 | 
						|
	rm -rf ../wmgeneral/*.o
 | 
						|
 | 
						|
install:
 | 
						|
	$(INSTALL) $(INSTALLEXEFLAGS) $(EXE) $(BINDIR)
 | 
						|
	$(INSTALL) -d $(MANDIR)/man1
 | 
						|
	$(INSTALL) $(INSTALLMANFLAGS) $(MAN) $(MANDIR)/man1
 |