Stand With Ukraine

Saturday, March 27, 2010

How to create a make file

Recently I had to deal with mixed c++ and fortran project, and decided to use eclipse for development, created managed make C/C++ project, and wrote Makefile. I used eclipse in order to speed up. I like the navigation and auto completion features, pretty lazy to type everything. I am aware of the perl script mkmf which is very good and I also used it, but for the simple project like this one I decided that it is easier to do it by hand.

How this works.
It is very simple you just have to specify input and output files and actions which should be performed to obtain the output. Schematically it looks like this:



resultfile(s): inputfile(s)
action


Note that the tabs are important.
Also you can specify ierarchical dependance, I like this feature very much:



...
result2 : result1
action2

result : result1
action1

all : result


Here is the example Makefile that I've created for that project.

##############Makefile


#set variables, compilers, libs, and others if you'll need them
CXX = pgCC
FC = pgf90

CXXFLAGS = -O2 -g -c
FCFLAGS = -i8 -r8 -byteswapio -c

OBJS = meshrouteX11.o readccc.o
CFILES = meshrouteX11.cpp
FORTRANFILES = readccc.f90

LIBS = -lg2c -pgf90libs $(CLIMLIB)/lib/losub.a -lm

TARGET = meshroute.exe

#create object files
$(OBJS): $(CFILES) $(FORTRANFILES)
$(CXX) $(CXXFLAGS) $(CFILES)
$(FC) $(FCFLAGS) $(FORTRANFILES)

#resultfile: inputfile
# action
$(TARGET): $(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(LIBS)

all: $(TARGET)

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



Another simple example of the Makefile
##############Makefile


FC = gfortran

*.o : *.f90
$(FC) -c *.f90

all : *.o
$(FC) *.o -o demo.exe

clean:
rm -rf *.exe
rm -rf *.o


Ukrainian and Russian songs I like

I don't know why but yesterday I was in one of my melancholic states and decided to listen the songs in my native language, I don't say that they are the best, but for me today they are. I feel that it would be great to share with the world my likes in this area. If you do not care about it you can safely stop reading this post )) I am a pretty lame with all the musical and art stuff, just liked it... Just wanted to create this list for me and for those who cares about my interests. http://www.youtube.com/watch?v=HWF-webN9oo http://www.youtube.com/watch?v=ajEiqtLfhDA&playnext=17&playnext_from=QL http://www.youtube.com/watch?v=kmVmlExp_xM&playnext=1&playnext_from=QL http://www.youtube.com/watch?v=amgMOPsmXiY&playnext=1&playnext_from=QL http://www.youtube.com/watch?v=OuKZkQXYr7Q&playnext=2&playnext_from=QL http://www.youtube.com/watch?v=XZpFg9EnajM&feature=related

Tuesday, March 23, 2010

Installed KDE, like it

Recently my HDD crashed, and I had to buy a new one. Reinstalled the system Ubuntu 9.10 and set up, backup system on the external usb drive,which was also bought after this occasion, after which I have lost a peace of important data. The most important homeworks and projects were saved at dropbox site. Also besides Gnome installed KDE, since now I have more space. It looks very nice, so also with this post I would like to start a series of motivation screenshots of KDE. Also I like that I could just logout from kde and start gnome, but still it is not necessary since all the gnome applications are available in KDE and vice versa.