Skip to content

Makefile_added#1

Open
madza93 wants to merge 4 commits intoziobron:masterfrom
madza93:master
Open

Makefile_added#1
madza93 wants to merge 4 commits intoziobron:masterfrom
madza93:master

Conversation

@madza93
Copy link

@madza93 madza93 commented Jan 18, 2019

No description provided.

Copy link
Owner

@ziobron ziobron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skomentowane bezpośrednio w pliku Makefile. W razie niejasności pytaj :)

Makefile Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-std=c++17 przerzuć do CFLAGS.
Zwyczajowo też zmienna o nazwie CFLAGS odnosi się do języka C. W C++ nazywa się ją CXXFLAGS.
CC podobnie stosuje się w C, a w C++ nazywa się ją CXX, więc możesz zmienić te nazwy :)

Pod zmienną OBJECTS umieszcza się pliki obiektowe, czyli te które są po etapie kompilacji, z rozszerzeniem* .o.
W zmiennej SOURCES umieszcza się pliki *.cpp

Makefile Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Użyj też proszę zmiennych $@ i $< zarówno w celu debug jak i w release
https://stackoverflow.com/questions/3220277/what-do-the-makefile-symbols-and-mean

Copy link
Owner

@ziobron ziobron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Już jest coraz bliżej prawidłowego rozwiązania :-) jeszcze tylko drobne poprawki.

Makefile Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zmiennej $< nie musisz definiować. Ta zmienna jest automatycznie dostępna w każdym celu i oznacza pierwszy element z listy zależności, czyli zarówno dla debug jak i release będzie ona miała wartość *.cpp, a więc może zastąpić zmienną $(SOURCES), która tak naprawdę może trafić na listę zależności właśnie :-)
Zmienną $@ używasz poprawnie :)

Makefile Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aby było w pełni poprawnie to brakuje Ci kropki - *.cpp. Bez tego do zmiennej SOURCES załapałby się np taki plik jak hellocpp

@ziobron
Copy link
Owner

ziobron commented Jan 20, 2019

Hej, zobacz zmiany Martyny: https://github.com/LordLukin/modern_cpp/pull/2/files
O coś takiego chodzi ;)

Copy link
Owner

@ziobron ziobron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Już cele debug i release powinny przy takim kodzie działać :)
Jeszcze all i clean wymagają poprawy, bo używasz tam $<, które tak naprawdę można użyć w debug i release, ale o nie nie będę się już czepiał.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments