diff --git a/.gitignore b/.gitignore index 040084b..c00a739 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ # Ignore binaries bin/ -*.o diff --git a/Makefile b/Makefile index 27552ee..e3d9c0d 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/obj/readme.txt b/obj/readme.txt deleted file mode 100644 index 798752b..0000000 --- a/obj/readme.txt +++ /dev/null @@ -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).