OpenXcom Forum

Contributions => Programming => Topic started by: Eeyoocah5Moh on June 24, 2010, 02:58:04 pm

Title: Cleaned up Makefile
Post by: Eeyoocah5Moh on June 24, 2010, 02:58:04 pm
I have cleaned up Makefile.

Code: [Select]
PROG = openxcom
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:.cpp=.o)

CXXFLAGS = -Wall -O2 `sdl-config --cflags`
LDFLAGS = `sdl-config --libs` -lSDL_gfx -lSDL_mixer

$(PROG): $(OBJS)
$(CXX) $(LDFLAGS) -o $(PROG) $(OBJS)

clean:
rm -f $(PROG) *.o

.PHONY: clean

Current Makefile uses $(CC) instead of $(CXX). CC is a *C* compiler, not C++. C++ compiler is CXX. You have rule for "openxcom" but instead you build "OpenXcom". Names are case-sensitive on Linux. You have also wrote your own implicit rule, don't know why. And `sdl-config --cflags`should not be in $(LIBS) BTW.
Title: Re: Cleaned up Makefile
Post by: SupSuper on June 26, 2010, 08:10:57 pm
Thanks, I've commited it to SVN. I'm not familiar with Makefile standards so most of it was mish-mashed from tutorials around the web (example (https://myweb.stedwards.edu/laurab/help/makefilehelp.html)) and they seem to happily use a CC variable and such.

As for the "openxcom" vs "OpenXcom" thing, the executables on other platforms are called "OpenXcom" so I figured I'd keep it consistent, but I guess it doesn't really matter.

Title: Re: Cleaned up Makefile
Post by: Eeyoocah5Moh on June 26, 2010, 11:21:16 pm
As for the "openxcom" vs "OpenXcom" thing, the executables on other platforms are called "OpenXcom" so I figured I'd keep it consistent, but I guess it doesn't really matter.

I don't ask you to use "openxcom" instead of "OpenXcom" or otherwise. There were a bug in previous Makefile: you had rule for making "openxcom" that makes "OpenXcom". So when you run it the second time, it would not find "openxcom" and build "OpenXcom" again.