Makefile 4.52 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
##
## Makefile
##  
## Made by Jens Gustedt
## Login   <gustedtdamogran.loria.fr>
##
## Started on  Sat Feb 20 21:57:30 2010 Jens Gustedt
## Last update Sat Feb 20 21:57:30 2010 Jens Gustedt
## 

SRC	=					\
		test-p99-block.c		\
		test-p99-cases.c		\
		test-p99-choice.c		\
		test-p99-classification.c	\
		test-p99-compound.c		\
		test-p99-double.c		\
18
		test-p99-error.c		\
19
		test-p99-fstruct.c		\
20 21 22
		test-p99-int.c			\
		test-p99-ndim.c			\
		test-p99-pow.c			\
23
		test-p99-qualifier.c            \
Jens Gustedt's avatar
Jens Gustedt committed
24
		test-p99-rand.c 		\
Jens Gustedt's avatar
Jens Gustedt committed
25
		test-p99-thread.c		\
26 27
		test-p99-va-arg.c

28 29 30 31
ifeq (${NO_TEST_C11},)
SRC	+=	test-p99-c11.c
endif

32 33 34 35 36
ASRC	=       				\
		libp99.c			\
		libp99-weak.c


37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
HTML = 						\
c99-conformance-clang-2.9.html			\
c99-conformance-gcc-4.1.html			\
c99-conformance-gcc-4.2.html			\
c99-conformance-gcc-4.3.html			\
c99-conformance-gcc-4.4.html			\
c99-conformance-icc-12.0.0.html			\
c99-conformance-opencc-4.2.4.html		\
c99-conformance-p99-gcc-4.1.html		\
c99-conformance-p99-gcc-4.2.html		\
c99-conformance-p99-gcc-4.3.html		\
c99-conformance-p99-gcc-4.4.html		\
c99-conformance-p99-pcc-0.9.9.html		\
c99-conformance-pcc-0.9.9.html			\
c99-conformance-tcc-0.9.25.html

INCL  	=		# List of *.h
################
# Optional add #
################
OPT     += -O0
58
IPATH   += -I../p99
59
OBJOPT  += -Wall -Wstrict-prototypes  -fdata-sections -ffunction-sections ${OPT}
60
EXEOPT  += ${OPT}
61
LPATH   += -L.
62
COPY = "all rights reserved, "
Jens Gustedt's avatar
Jens Gustedt committed
63
LICENSE = SHORTLICENCE-open.txt
64 65
SCRIPTS = ../scripts
AUTH = ${SCRIPTS}/AUTHORS.txt
Jens Gustedt's avatar
Jens Gustedt committed
66
TIDY = ../../../parxxl/scripts/findSvnAuthors --type c --auth ${AUTH} --copy ${COPY} --lice ${LICENSE} --ofile
67 68 69
CONFORM = ${SCRIPTS}/p99_conformance.pl

ifneq (${POSIX_SEMAPHORES}, -1L)
70
LDFLAGS := ${LDFLAGS}
71 72
endif

73 74 75
LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections


76 77 78 79 80 81 82
#####################
# Macro Definitions #
#####################
CC 	= c99
MAKE 	= make
SHELL	= /bin/sh
OBJS 	= $(SRC:.c=.o)
83 84 85
AOBJS 	= $(ASRC:.c=.o)
ASSEM 	= $(ASRC:.c=.s)
ALIB 	= $(ASRC:.c=.a)
86
NAME 	= $(SRC:.c=)
87 88 89 90 91 92
RM 	= /bin/rm -f
COMP	= gzip -9v
UNCOMP	= gzip -df
STRIP	= strip

CFLAGS  += $(OBJOPT) $(IPATH)
93
LDFLAGS := $(EXEOPT) $(LPATH) $(LDFLAGS)
94 95 96

.SUFFIXES: .h.Z .c.Z .h.gz .c.gz .c.z .h.z

97 98 99 100 101 102 103 104 105
# every POSIX platform must provide getconf
XOPEN_VERSION := ${shell getconf _XOPEN_VERSION 2>/dev/null}
GNU_LIBC_VERSION := ${shell getconf GNU_LIBC_VERSION 2>/dev/null}

ifneq (${XOPEN_VERSION},)
CFLAGS += -D_XOPEN_SOURCE=${XOPEN_VERSION}
endif
ifneq (${GNU_LIBC_VERSION},)
CFLAGS += -D_GNU_SOURCE=1
106
LDFLAGS += -lrt
107 108
endif

109 110 111 112
##############################
# Basic Compile Instructions #
##############################

113
all:	$(NAME) $(ASSEM) $(ALIB)
114 115 116
% : %.o
	$(CC) $< $(LDFLAGS) -o $@

117 118 119
%.a : %.o
	$(AR) crf $@ $<

120 121 122
test-p99-inline : test-p99-inline.o test-p99-inline-empty.o
	$(CC) $^ $(LDFLAGS) -o $@

123 124 125
depend Makefile.inc: Makefile
	${CC} $(CFLAGS) $(IPATH) -MM $(SRC) $(ASRC) test-p99-inline.c test-p99-inline-empty.c > Makefile.inc
	${CC} $(CFLAGS) $(IPATH) -MM $(SRC) $(ASRC) test-p99-inline.c test-p99-inline-empty.c | sed 's/[.]o/.s/g' >> Makefile.inc
126
clean:
127
	-$(RM) $(NAME) $(OBJS) $(AOBJS) $(ASSEM) $(ALIB) *~
128 129 130 131 132 133 134 135 136 137 138 139 140
distclean: clean
	-$(RM) Makefile.inc
fclean:
	-$(RM) $(NAME)
comp: clean
	$(COMP) $(INCL) $(SRC)
ucomp:
	$(UNCOMP) $(SRC) $(INCL)

.c.Z.c .h.Z.h .c.gz.c .h.gz.h .c.z.c .h.z.h :
	 -$(UNCOMP) $<

.c.o:
141
	$(CC) $< $(CFLAGS) -c
142

143
.c.s:
144
	$(CC) $< $(CFLAGS) -S
145

146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161

tidy :
	for f in ${SRC} ; do  ${TIDY} $$f ; done

html : ${HTML}

c99-conformance-clang-2.9.html : ${CONFORM}
	${CONFORM} clang 2.9
c99-conformance-gcc-4.1.html : ${CONFORM}
	${CONFORM} gcc-4.1
c99-conformance-gcc-4.2.html : ${CONFORM}
	${CONFORM} gcc-4.2
c99-conformance-gcc-4.3.html : ${CONFORM}
	${CONFORM} gcc-4.3
c99-conformance-gcc-4.4.html : ${CONFORM}
	${CONFORM} gcc-4.4
162 163
c99-conformance-gcc-4.5.html : ${CONFORM}
	${CONFORM} gcc-4.5
164 165 166 167 168 169 170 171 172 173 174 175
c99-conformance-icc-12.0.0.html : ${CONFORM}
	${CONFORM} icc 12.0.0
c99-conformance-opencc-4.2.4.html : ${CONFORM}
	${CONFORM} opencc 4.2.4
c99-conformance-p99-gcc-4.1.html : ${CONFORM}
	${CONFORM} ${SCRIPTS}/p99-gcc-4.1
c99-conformance-p99-gcc-4.2.html : ${CONFORM}
	${CONFORM} ${SCRIPTS}/p99-gcc-4.2
c99-conformance-p99-gcc-4.3.html : ${CONFORM}
	${CONFORM} ${SCRIPTS}/p99-gcc-4.3
c99-conformance-p99-gcc-4.4.html : ${CONFORM}
	${CONFORM} ${SCRIPTS}/p99-gcc-4.4
176 177
c99-conformance-p99-gcc-4.5.html : ${CONFORM}
	${CONFORM} ${SCRIPTS}/p99-gcc-4.5
178 179 180 181 182 183 184 185 186 187 188 189 190
c99-conformance-p99-pcc-0.9.9.html : ${CONFORM}
	${CONFORM} ${SCRIPTS}/p99-pcc 0.9.9
c99-conformance-pcc-0.9.9.html : ${CONFORM}
	${CONFORM} pcc 0.9.9
c99-conformance-tcc-0.9.25.html : ${CONFORM}
	${CONFORM} tcc 0.9.25


################
# Dependencies #
################

include Makefile.inc