Place q1_4 files in the right place

This commit is contained in:
Yorick Barbanneau 2023-02-14 00:50:29 +01:00
parent 8e3fb6fe6d
commit 2fb80be762
7 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,7 @@
int foo (int x) {
int i = 10;
return i+2;
}
int main () {
return foo (1);
}

View file

@ -0,0 +1,8 @@
void foo (int a, int b, int c, int d, int e, int f) {
int i = 10 + a + b + c + d + e + f;
}
int main () {
foo (1, 2, 3, 4, 5, 6);
return 0;
}

View file

@ -0,0 +1,8 @@
void foo (float a, int b, int c, int d, int e, int f, int g) {
float i = 10 + a + b + c + d + e + f + g;
}
int main () {
foo (1, 2, 3, 4, 5, 6, 7);
return 0;
}

View file

@ -0,0 +1,8 @@
void foo (int a, int b, int c, int d, int e, int f, int g) {
int i = 10 + a + b + c + d + e + f + g;
}
int main () {
foo (1, 2, 3, 4, 5, 6, 7);
return 0;
}

View file

@ -0,0 +1,8 @@
void foo (float a, int b, int c, int d, int e, int f, int g, int h) {
float i = 10 + a + b + c + d + e + f + g + h;
}
int main () {
foo (1, 2, 3, 4, 5, 6, 7, 8);
return 0;
}

View file

@ -0,0 +1,8 @@
void foo (int a, int b, int c, int d, int e, int f, int g, int k, int l) {
int i = 10 + a + b + c + d + e + f + g + k + l;
}
int main () {
foo (1, 2, 3, 4, 5, 6, 7, 8, 9);
return 0;
}

View file

@ -0,0 +1,36 @@
CC = gcc
CFLAGS = -Wall -Wextra -no-pie -lm -g -std=c99
SRC = $(wildcard *.c)
TGT = $(subst .c,,$(SRC))
BUILD_DIR = build
DUMP_DIR = dump
$(BUILD_DIR)/%_32: %.c
$(shell mkdir -p $(BUILD_DIR))
$(CC) $(CFLAGS) -m32 -o $@ $<
$(BUILD_DIR)/%_64: %.c
$(shell mkdir -p $(BUILD_DIR))
$(CC) $(CFLAGS) -m64 -o $@ $<
$(DUMP_DIR)/%_32.txt: $(BUILD_DIR)/%_32
$(shell mkdir -p $(DUMP_DIR))
objdump -Sd $< > $@
$(DUMP_DIR)/%_64.txt: $(BUILD_DIR)/%_64
$(shell mkdir -p $(DUMP_DIR))
objdump -Sd $< > $@
build: $(addprefix $(BUILD_DIR)/, $(addsuffix _32, $(TGT))) \
$(addprefix $(BUILD_DIR)/, $(addsuffix _64, $(TGT)))
dump: $(addprefix $(DUMP_DIR)/, $(addsuffix _32.txt, $(TGT))) \
$(addprefix $(DUMP_DIR)/, $(addsuffix _64.txt, $(TGT)))
PHONY: clean
clean:
@rm -rf $(BUILD_DIR)
@rm -rf $(DUMP_DIR)