-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
51 lines (34 loc) · 982 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
HFILES = glob.h choose.h gen.h
CFILES = gen.c main.c command.c util.c
OBJECTS = gen.o main.o command.o util.o
LIBS = -lm
UNAME := $(shell uname)
ifeq ($(UNAME), FreeBSD)
# Fix to use your own version of GCC
LINKER=-Wl,-rpath=/usr/local/lib/gcc11
endif
CC = g++
#PROFILE=-pg
#GDB=-ggdb3
#DEBUG=-DDEBUG
ifndef DEBUG
OPT=-Ofast -pipe -march=native -mtune=native #-m64
endif
# For some reasons, -static does not work on Mac OS X (MacPorts g++ 4.9) (FIXME)
STATIC=-static
ifeq ($(UNAME), Darwin)
STATIC=-static-libgcc -static-libstdc++
endif
WARNS=-Wextra -Wall -Wshadow -Wstrict-aliasing=1 -Werror -pedantic-errors
CFLAGS=-ansi -std=c++11 -fabi-version=6 $(WARNS) $(OPT) $(STATIC) $(GDB) $(DEBUG) $(PROFILE)
EXEC = gen
.PHONY: all default clean mrproper
all: default
default: $(EXEC)
gen: $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) $(LINKER) $(LIBS) -fwhole-program -o gen
mrproper:
-/bin/rm -f $(OBJECTS) $(EXEC)
clean:
-/bin/rm -f $(OBJECTS)
$(OBJECTS): $(HFILES)