File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed
Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change 11#ifndef HD_H
22#define HD_H
33
4+ #define ARRAYSIZE (a ) (sizeof(a) / sizeof(*(a)))
5+
46#define BLACK 0
57#define BLUE 1
68#define GREEN 2
Original file line number Diff line number Diff line change 1- CC = cl.exe -nologo
2- CFLAGS = -WX -W4 -sdl -arch:IA32 -O2 -D_CRT_SECURE_NO_WARNINGS
3- LINK = link.exe -nologo
4- LDFLAGS = -subsystem:console,"5.01"
1+ CL = cl.exe -nologo -WX -W4 -sdl -arch:IA32 -O2 -D_CRT_SECURE_NO_WARNINGS
2+ LINK = link.exe -nologo -subsystem:console,"5.01"
3+ GCC = gcc -std=c99 -O2 -fdiagnostics-color -mconsole
4+ LD = gcc -mconsole
55
66all : tests hd.exe
77
@@ -11,19 +11,25 @@ test : tests
1111tests : hd-tests.exe
1212
1313hd-tests.exe : hd-tests.obj hd.obj
14- $(LINK ) $(LDFLAGS ) hd-tests.obj hd.obj
14+ @$(LINK ) hd-tests.obj hd.obj \
15+ 2> /dev/null || $(LD ) $(LDFLAGS ) -o hd-tests.exe hd-tests.obj hd.obj
1516
1617hd-tests.obj : hd-tests.c hd.h
17- $(CC ) $(CFLAGS ) -c hd-tests.c
18+ @$(CL ) -c hd-tests.c \
19+ 2> /dev/null || $(GCC ) $(CFLAGS ) -c hd-tests.c -o hd-tests.obj
1820
1921hd.exe : hd.obj main.obj
20- $(LINK ) $(LDFLAGS ) hd.obj main.obj
22+ @$(LINK ) hd.obj main.obj \
23+ 2> /dev/null || $(LD ) $(LDFLAGS ) -o hd.exe hd.obj main.obj
2124
2225hd.obj : hd.c hd.h
23- $(CC ) $(CFLAGS ) -c hd.c
26+ @$(CL ) -c hd.c \
27+ 2> /dev/null || $(GCC ) $(CFLAGS ) -c hd.c -o hd.obj
2428
2529main.obj : main.c hd.h
26- $(CC ) $(CFLAGS ) -c main.c
30+ @$(CL ) -c main.c \
31+ 2> /dev/null || $(GCC ) $(CFLAGS ) -c main.c -o main.obj
2732
2833clean :
29- del hd-tests.obj hd-tests.exe hd.obj hd.exe main.obj 2> NUL
34+ del hd-tests.obj hd-tests.exe hd.obj hd.exe main.obj 2> NUL \
35+ 2> /dev/null || rm -f hd-tests.obj hd-tests.exe hd.obj hd.exe main.obj
You can’t perform that action at this time.
0 commit comments