Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
SkillfulElectro authored Mar 29, 2024
1 parent 3cb606b commit c731ca2
Show file tree
Hide file tree
Showing 24 changed files with 94 additions and 0 deletions.
2 changes: 2 additions & 0 deletions learning_make0/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
blah: blah.c
cc blah.c -o blah
Binary file added learning_make0/blah
Binary file not shown.
3 changes: 3 additions & 0 deletions learning_make0/blah.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int main(void){
return 0;
}
9 changes: 9 additions & 0 deletions learning_make1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
blah: blah.o
cc blah.o -o blah # Runs third

blah.o: blah.c
cc -c blah.c -o blah.o # Runs second

# Typically blah.c would already exist, but I want to limit any additional required files
blah.c:
echo "int main() { return 0; }" > blah.c # Runs first
Binary file added learning_make1/blah
Binary file not shown.
1 change: 1 addition & 0 deletions learning_make1/blah.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int main() { return 0; }
Binary file added learning_make1/blah.o
Binary file not shown.
5 changes: 5 additions & 0 deletions learning_make2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
some: other
echo "hi gogoli"
touch some
other:
echo "im first"
Empty file added learning_make2/other
Empty file.
Empty file added learning_make2/some
Empty file.
6 changes: 6 additions & 0 deletions learning_make3/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
some_file: other_file
echo "This will always run, and runs second"
touch some_file

other_file:
echo "This will always run, and runs first"
Empty file added learning_make3/some_file
Empty file.
11 changes: 11 additions & 0 deletions learning_make4/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#defining vars , vars can only be string
file := file1 file2
some_file : $(file)
echo "some file is called " $(file)
touch some_file
file1:
touch file1
file2:
touch file2
clean:
rm -f file1 file2 some_file
Empty file added learning_make4/file1
Empty file.
Empty file added learning_make4/file2
Empty file.
Empty file added learning_make4/some_file
Empty file.
15 changes: 15 additions & 0 deletions learning_make5/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#rename the file or dir is possible with this syntax :
# mv {current name of the file} {new name of the file}
# remove :
# rm -f {file name}

a := "something"
b := 'something'
c := something
var_test:
echo "a is " $(a)
echo "b is " $(b)
echo "c is " $(c)
echo 'b is ' $(b)

# just run make to see what it prints
9 changes: 9 additions & 0 deletions learning_make6/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#from the prev example we saw there is no diff between "' but check this example out

a := hi
b := 'hi'
c := "hi"
test:
printf $a
printf $b
printf $c
13 changes: 13 additions & 0 deletions learning_make7/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#as you know in when you run the make command without specifying the target , it will run
#the first target , if you want to without specifying the target it runs some of the targets
#you can do so by creating a target which calls others
all: one two three

one:
touch one
two:
touch two
three:
touch three
clean:
rm -f one two three
Empty file added learning_make7/one
Empty file.
Empty file added learning_make7/three
Empty file.
Empty file added learning_make7/two
Empty file.
8 changes: 8 additions & 0 deletions learning_make8/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#when you want to do the same thing for each target , you dont have to write the same things many time
#just do this

all : f0.o f1.o

f0.o f1.o:
echo $@
# run the following , you will get what @ means here
12 changes: 12 additions & 0 deletions learning_make9/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# % and * are both wildcard
# * searches file system for what we want
# Print out file information about every .c file

#uncomment this later
#all: create print
#create:
# echo "int main(){return0;}" > test.c

print: $(wildcard *.c)
ls -l $?
#if wildcard is not used , it will stay at *.c if no file found

0 comments on commit c731ca2

Please sign in to comment.