Skip to content

Commit

Permalink
还是每个系统独立Makefile比较好
Browse files Browse the repository at this point in the history
Signed-off-by: Cheng Cao <bobcaocheng@163.com>
  • Loading branch information
Cheng Cao committed Dec 6, 2016
1 parent e13b948 commit c6f1ff8
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
30 changes: 30 additions & 0 deletions VMDE/Makefile.gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Mac does not support that make.rb, in a strange way..

CXX = gcc
CCLD = gcc

OBJ = libVMDE.so
Src = $(shell find . -name "*.cpp")
Objects = $(patsubst %.cpp, %.o, $(Src))

LIBS = $(shell pkg-config --libs glfw3 gl glm glew portaudio-2.0 ogg vorbisfile) -lstdc++ /usr/lib/libSOIL.so
LDFLAGS = -shared -O4
CXXFLAGS = -I../lib/SOIL/include -I../ \
$(shell pkg-config --cflags gl glfw3 glm glew portaudio-2.0 vorbisfile) \
-std=c++14 -Wall -Wextra -O3 -c -fPIC \
-Ofast -msse4.1 -mtune=core2

all: $(OBJ)

.cpp.o: .cpp
@echo 编译C++文件$^……
$(CXX) $(CXXFLAGS) $^ -o $@

$(OBJ): $(Objects)
@echo 链接最终二进制
$(CCLD) $(LIBS) $(LDFLAGS) $^ -o $(OBJ)

clean:
rm -rf $(OBJ) $(Objects)

.PHONY: all clean
File renamed without changes.
33 changes: 33 additions & 0 deletions VMGS/Makefile.gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# make.rb is not working on Mac

CXX = clang++
CCLD = clang

OBJ = VMGS
Src = $(shell find . -name "*.cpp")
Objects = $(patsubst %.cpp, %.o, $(Src))

LIBS = $(shell pkg-config --libs --static glfw3 glm gl glew portaudio-2.0 vorbisfile) -lstdc++
LDFLAGS = -O4 -fPIC ../VMDE/libVMDE.so
CXXFLAGS = -I../lib/SOIL/include -I../VMDE \
$(shell pkg-config --cflags glfw3 glm glew gl portaudio-2.0 vorbisfile) \
-I../ -std=c++14 -Wall -Wextra -O3 -c \
-Ofast -msse4.1 -mtune=core2

all: $(OBJ)
run: all
@echo 运行
./$(OBJ)

.cpp.o: .cpp
@echo 编译C++文件$^……
$(CXX) $(CXXFLAGS) $^ -o $@

VMGS: $(Objects)
@echo 链接最终二进制
$(CCLD) $(LIBS) $(LDFLAGS) $^ -o VMGS

clean:
rm -rf $(OBJ) $(Objects)mcpu

.PHONY: all run clean
File renamed without changes.

0 comments on commit c6f1ff8

Please sign in to comment.