Announcement

Collapse
No announcement yet.

Linux Makefile Help

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Linux Makefile Help

    Hi,

    Can someone who is excellent with Linux makefiles look at our makefile and make changes as necessary?
    We are working on a cross-platform open-source educational word spelling game.

    You can download the current game project with included makefile at below URL link:
    CURRENT SOURCE

    The current makefile has worked for many years, just looking to improve it moving forward.
    Thank you in advance!

    Jesse
    Last edited by JeZ-l-Lee; May 14, 2018, 04:32 PM.

    #2
    Below is the makefile if you don't want to download the whole project:

    Code:
    # "LettersFall[TM]" - MAKEFILE by JeZxLee & mattmatteh...
    # (C)opyright 2018 By www.FallenAngelSoftware.com
    
    TARGET = lf
    
    VERSION = 5.0
    
    DEL_FILE = rm -f
    
    CC      = g++
    CFLAGS = -pipe -Wall -g #-"ggdb"
    SDL_CFLAGS = $(shell sdl2-config --cflags)
    SDL_LIBS = $(shell sdl2-config --libs) 
    
    SDL_TTF_LIBS	= -lSDL2_ttf
    SDL_IMAGE_LIBS	= -lSDL2_image
    SDL_MIXER_LIBS  = -lSDL2_mixer
    
    OBJECTS = src/main.o \
             src/audio.o \
             src/data.o \
             src/input.o \
             src/interface.o \
             src/logic.o \
             src/screens.o \
             src/visuals.o
    
    SOURCES = src/main.cpp \
             src/audio.cpp \
             src/data.cpp \
             src/input.cpp \
             src/interface.cpp \
             src/logic.cpp \
             src/screens.cpp \
             src/visuals.cpp
    
    HEADERS = src/audio.h \
             src/data.h \
             src/input.h \
             src/interface.h \
             src/logic.h \
             src/screens.h \
             src/visuals.h
    
    $(TARGET): $(OBJECTS)
    	$(CC) $(OBJECTS) $(SDL_LIBS) $(SDL_TTF_LIBS) $(SDL_IMAGE_LIBS) $(SDL_MIXER_LIBS) -o $@
    
    .cpp.o:
    	$(CC) $(CFLAGS) $(SDL_CFLAGS) -c $< -o $@
    
    clean:
    	rm $(OBJECTS) $(TARGET)

    Comment


      #3
      I like using simple makefiles like yours. But if your number of sources substantially increased, I suggest investigating more sophisticated tools, always bearing in mind how portable you want to be. F. ex., tools often do automatic scanning for header files. I think KDE uses CMake.

      I'm no expert, but I wonder why you're using the variables for C compiling when you're using C++? For Gnu make the variables for C++ are CXX and CXXFLAGS. You could add your flags to CXXFLAGS and your libraries to LDLIBS and use the default rules.
      Regards, John Little

      Comment


        #4
        CMake is your friend. Its much more flexable then just making makefiles manually. Its also a lot more portable and will genertate build files for more then just unix.
        Mark Your Solved Issues [SOLVED]
        (top of thread: thread tools)

        Comment

        Working...
        X