Changed Makefile to allow cross-architecture compilation.

This commit is contained in:
Deathsbreed 2014-11-06 20:29:12 -06:00
parent a5bb1744f4
commit a4dcbe504e
3 changed files with 13 additions and 16 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
# Ignore binaries
bin/
*.o

View File

@ -1,25 +1,24 @@
CXX=gcc
CXXFLAGS= -O3 -Wall -std=gnu99
INCLUDES=
LIBS=
MV=mv
MKDIR=mkdir -p
RM=rm -rf
SRC_FILES := $(wildcard src/*.c)
OBJ_FILES := $(addprefix obj/, $(notdir $(SRC_FILES:.c=.o)))
LBITS := $(shell getconf LONG_BIT)
all: $(OBJ_FILES)
$(MKDIR) bin
$(CXX) $(CXXFLAGS) $(LIBS) -o bin/cointoss obj/*.o
ifeq ($(LBITS),32)
all: compile32bit
else
all: compile64bit
endif
obj/%.o: src/%.c
$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
compile32bit:
$(MKDIR) bin/lin32/
$(CXX) $(CXXFLAGS) -m32 -o bin/lin32/cointoss src/main.c
compile64bit:
$(MKDIR) bin/lin64/
$(CXX) $(CXXFLAGS) -m64 -o bin/lin64/cointoss src/main.c
clean:
$(RM) obj/*.o
cleanall: clean
$(RM) bin

View File

@ -1 +0,0 @@
This is where the object output files go. This readme file is a simple hack so that git registers it (git doesn't register empty directories).