Thursday, January 28, 2010

Schedule Task, View Dependencies


On Win2K+, schedule commands to run
## at
Eg: at 07:45 "shutdown -s"
Shuts down the PC at 7:45 am.
You can view these tasks in Control Panel as well.

On *nix, view shared library dependencies of an executable.
## ldd


Sunday, January 17, 2010

Make It Fast!

Sharing a template for an easy to use make file system.
  • Self-maintaining: No need for manually adding files.
  • Quick-and-dirty: Get started fast!

Here goes:

SOURCE_FILES= $(wildcard *.cpp) ../../commando/sonar/Sonar.cpp
# Automatically gets the file-list from the directory!
# Add extra files from other dirs at the end if needed (Sonar.cpp above)

OBJS=$(patsubst %.cpp, %.o,$(SOURCE_FILES))
# Rule for specifying object file list
# The rest of this is standard make-file stuff   
COMPILER=g++
CFLAGS= -W -g -O0 -fexceptions -finline-functions -D_THREAD_SAFE -fpack-struct=4
#Compiler options
LIBS= -lboost_filesystem
#Libraries to link to
SEARCHDIRS = -I../inc -L../lib
#Include and library directories  

TARGET= ../../homebase/linux/nuboat
# Output file

.PHONY:all
all: $(TARGET)

$(TARGET): $(OBJS)
$(COMPILER) $(CFLAGS) $(SEARCHDIRS) $(GLOBALS) $(OBJS) $(LIBS) -o $(TARGET)

%.o: %.cpp
$(COMPILER) $(CFLAGS) $(SEARCHDIRS) $(GLOBALS) -o $@ -c $<

.PHONY:
clean
clean:
-rm -f $(OBJS) $(TARGET)

You can use this so long as you don't have source files floating around in the Makefile's directory, which should not be included in the build.