Author Topic: Cleaned up Makefile  (Read 11777 times)

Offline Eeyoocah5Moh

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Cleaned up Makefile
« 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.
« Last Edit: June 24, 2010, 03:01:48 pm by Eeyoocah5Moh »

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Cleaned up Makefile
« Reply #1 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) 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.


Offline Eeyoocah5Moh

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: Cleaned up Makefile
« Reply #2 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.