--- Makefile.orig 2010-01-24 02:21:57.196476493 -0500 +++ Makefile 2010-01-24 02:27:52.134475800 -0500 @@ -3,19 +3,20 @@ # By R. Belmont # -CC = gcc -CPP = g++ -CFLAGS = -c -O3 -g3 -CFLAGS += -DNST_PRAGMA_ONCE_SUPPORT -D_SZ_ONE_DIRECTORY -CFLAGS += -Isource -Isource/core -Isource/zlib -Isource/core/api -Isource/core/board -Isource/core/input -Isource/linux/unzip -CFLAGS += -Isource/core/vssystem -Isource/linux -Isource/nes_ntsc -I.. -I../nes_ntsc -Isource/linux/7zip -CFLAGS += `sdl-config --cflags` `pkg-config --cflags gtk+-2.0` -CFLAGS += -finline-limit=2000 --param inline-unit-growth=1000 --param large-function-growth=1000 -finline-functions-called-once +FLAGS = -c \ + -DNST_PRAGMA_ONCE_SUPPORT -D_SZ_ONE_DIRECTORY \ + -Isource -Isource/core -Isource/zlib -Isource/core/api -Isource/core/board -Isource/core/input -Isource/linux/unzip \ + -Isource/core/vssystem -Isource/linux -Isource/nes_ntsc -I.. -I../nes_ntsc -Isource/linux/7zip \ + `sdl-config --cflags` `pkg-config --cflags gtk+-2.0` \ + -finline-limit=2000 --param inline-unit-growth=1000 --param large-function-growth=1000 -finline-functions-called-once + +CFLAGS += $(FLAGS) +CXXFLAGS += $(FLAGS) # enable this for input debugging #CFLAGS += -DDEBUG_INPUT -CPPFLAGS = -Wno-deprecated -fno-rtti +CXXFLAGS += -Wno-deprecated -fno-rtti EXE = nst LIBS = -lm -lz -lasound `sdl-config --libs` `pkg-config --libs gtk+-2.0` @@ -144,6 +145,8 @@ OBJDIRS = objs objs/core objs/core/api objs/core/board objs/core/input objs/core/vssystem objs/nes_ntsc OBJDIRS += objs/linux objs/linux/7zip objs/linux/unzip +$(shell mkdir $(sort $(OBJDIRS))) + # build rules objs/%.o: source/%.c @echo Compiling $<... @@ -151,24 +154,19 @@ objs/%.o: source/%.cpp @echo Compiling $<... - @$(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@ + $(CC) $(CXXFLAGS) $< -o $@ objs/%.o: source/%.o @echo Compiling $<... @$.o) $(CFLAGS) $.oFLAGS) $< -o $@ -all: maketree $(EXE) $(GENNSTCONTROLS) - -maketree: $(sort $(OBJDIRS)) +all: $(EXE) $(GENNSTCONTROLS) -$(sort $(OBJDIRS)): - @echo Creating output directory $@ - @mkdir $@ # link the commandline exe $(EXE): $(OBJS) @echo Linking $@... - @$(CPP) -g -o $(EXE) $^ $(LIBS) + $(CXX) $(LDFLAGS) -g -o $(EXE) $^ $(LIBS) clean: -@rm -f $(OBJS) $(EXE) $(GENNSTCONTROLS)