Merge pull request #13 from CapsCollective/use-cxxflags

Updated Makefile to use CXXFLAGS for macro passing
This commit is contained in:
Jonathan Moallem 2021-10-15 08:10:35 +11:00 committed by GitHub
commit 5a09daf7d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -11,9 +11,6 @@ objects := $(patsubst src/%, $(buildDir)/%, $(patsubst %.cpp, %.o, $(sources)))
depends := $(patsubst %.o, %.d, $(objects))
compileFlags := -std=c++17 -I include
linkFlags = -L lib/$(platform) -l raylib
ifdef MACRO_DEFS
macroDefines := -D $(MACRO_DEFS)
endif
# Check for Windows
ifeq ($(OS), Windows_NT)
@ -88,7 +85,7 @@ $(target): $(objects)
# Compile objects to the build directory
$(buildDir)/%.o: src/%.cpp Makefile
$(MKDIR) $(call platformpth, $(@D))
$(CXX) -MMD -MP -c $(compileFlags) $< -o $@ $(macroDefines)
$(CXX) -MMD -MP -c $(compileFlags) $< -o $@ $(CXXFLAGS)
# Run the executable
execute:

View File

@ -92,18 +92,18 @@ $ make ARGS="--somearg"
```
### Specifying Custom Macro Definitions
You may also want to pass in your own macro definitions for certain configurations (such as setting log levels). You can pass in your definitions using the `MACRO_DEFS` flag:
You may also want to pass in your own macro definitions for certain configurations (such as setting log levels). You can pass in your definitions using `CXXFLAGS`:
#### macOS & Linux
```console
$ make MACRO_DEFS=MY_MACRO
$ make CXXFLAGS=-DMY_MACRO=1
```
#### Windows
```console
> mingw32-make MACRO_DEFS=MY_MACRO
> mingw32-make CXXFLAGS=-DMY_MACRO=1
```
### Specifying a Non-Default Compiler
@ -127,9 +127,9 @@ $ make CXX=g++
It's pretty simple actually:
1. Fork it from [here](https://github.com/CapsCollective/raylib-cpp-starter/fork)
2. Create your feature branch (git checkout -b cool-new-feature)
3. Commit your changes (git commit -m "Added some feature")
4. Push to the branch (git push origin cool-new-feature)
2. Create your feature branch (`git checkout -b cool-new-feature`)
3. Commit your changes (`git commit -m "Added some feature"`)
4. Push to the branch (`git push origin cool-new-feature`)
5. Create a new pull request for it!
### Contributors